parameterized-utils-2.1.11.0: Classes and data structures for working with data-kind indexed types

Copyright | (c) Galois Inc 2019
Maintainer | Langston Barrett <langston@galois.com>
Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Parameterized.All

Description

This module provides `All`, a GADT that encodes universal quantification/parametricity over a type variable.

The following is an example of a situation in which it might be necessary to use `All` (though it is a bit contrived):

      {-# LANGUAGE FlexibleInstances #-}
      {-# LANGUAGE GADTs #-}

      data F (x :: Bool) where
        FTrue :: F 'True
        FFalse :: F 'False
        FIndeterminate :: F b

      data Value =
        VAllF (All F)

      class Valuable a where
        valuation :: a -> Value

      instance Valuable (All F) where
        valuation = VAllF

      val1 :: Value
      val1 = valuation (All FIndeterminate)

For a less contrived but more complex example, see this blog post: http://comonad.com/reader/2008/rotten-bananas/

# Documentation

newtype All (f :: k -> Type) Source #

Constructors

All |

Fields

- getAll :: forall (x :: k). f x

#### Instances

Instances details

FoldableF (All :: (k -> Type) -> Type) Source # |

Instance details

Defined in Data.Parameterized.All

Methods

foldMapF :: Monoid m => (forall (s :: k). e s -> m) -> All e -> m Source #

foldrF :: (forall (s :: k). e s -> b -> b) -> b -> All e -> b Source #

foldlF :: (forall (s :: k). b -> e s -> b) -> b -> All e -> b Source #

foldrF' :: (forall (s :: k). e s -> b -> b) -> b -> All e -> b Source #

foldlF' :: (forall (s :: k). b -> e s -> b) -> b -> All e -> b Source #

toListF :: (forall (tp :: k). f tp -> a) -> All f -> [a] Source #

FunctorF (All :: (k -> Type) -> Type) Source # |
Instance details Defined in Data.Parameterized.All Methods fmapF :: (forall (x :: k). f x -> g x) -> All f -> All g Source #
ShowF f => Show (All f) Source # |
Instance details Defined in Data.Parameterized.All Methods showsPrec :: Int -> All f -> ShowS Source # show :: All f -> String Source # showList :: [All f] -> ShowS Source #
EqF f => Eq (All f) Source # |
Instance details Defined in Data.Parameterized.All Methods (==) :: All f -> All f -> Bool Source # (/=) :: All f -> All f -> Bool Source #

allConst :: forall {k} a. a -> All (Const a :: k -> Type) Source #