Copyright | (c) Edward Kmett and Dan Doel 2012 |
---|---|
License | BSD3 |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
- data Kind a
- data HardKind
- class Kindly k where
- data Schema a = Schema [Hint] !(Scope Int Kind a)
- schema :: Kind a -> Schema a
- general :: Ord k => Kind k -> (k -> Hint) -> Schema a
- class HasKindVars s t a b | s -> a, s b -> t, t -> b, t a -> s where
- kindVars :: Traversal s t a b
- wfk :: Kind a -> Bool
- wfb :: Kind a -> Bool
Kinds
Kinds with kind variables of type a
Monad Kind | |
Functor Kind | |
Applicative Kind | |
Foldable Kind | |
Traversable Kind | |
Show1 Kind | |
Read1 Kind | |
Ord1 Kind | |
Eq1 Kind | |
Digestable1 Kind | |
Hashable1 Kind | |
Serial1 Kind | |
Fun Kind | |
Variable Kind | |
BoundBy Schema Kind | |
Eq a => Eq (Kind a) | |
Data a => Data (Kind a) | |
Ord a => Ord (Kind a) | |
Read a => Read (Kind a) | |
Show a => Show (Kind a) | |
IsString a => IsString (Kind a) | |
Generic (Kind a) | |
Binary k => Binary (Kind k) | |
Hashable a => Hashable (Kind a) | |
Digestable k => Digestable (Kind k) | |
Serialize k => Serialize (Kind k) | |
Serial a => Serial (Kind a) | |
Plated (Kind a) | |
AsConvention (Kind k) | |
Kindly (Kind a) | |
HasKindVars (Kind a) (Kind b) a b | |
Typeable (* -> *) Kind | |
type Rep (Kind a) |
Hard Kinds
Kinds that can be compared by simple structural equality
Smart constructor for hard kinds
Kind Schemas
Kind schemas
Functor Schema | |
Foldable Schema | |
Traversable Schema | |
Hashable1 Schema | |
Serial1 Schema | |
Fun Schema | |
Variable Schema | |
BoundBy Schema Kind | |
Eq a => Eq (Schema a) | |
Data a => Data (Schema a) | |
Ord a => Ord (Schema a) | |
Read a => Read (Schema a) | |
Show a => Show (Schema a) | |
Generic (Schema a) | |
Binary k => Binary (Schema k) | |
Hashable a => Hashable (Schema a) | |
Digestable a => Digestable (Schema a) | |
Serialize k => Serialize (Schema k) | |
Serial k => Serial (Schema k) | |
Kindly (Schema a) | |
HasKindVars (Schema a) (Schema b) a b | |
Typeable (* -> *) Schema | |
type Rep (Schema a) |
schema :: Kind a -> Schema a Source
Lift a kind into a kind schema
>>>
schema (star ~> star)
Schema [] (Scope (Var (F (Type (HardKind Star) :-> Type (HardKind Star)))))
general :: Ord k => Kind k -> (k -> Hint) -> Schema a Source
Construct a schema from a kind, generalizing all free variables.
When working with Meta
variables, you want to use
generalize to zonk
the kind and check skolems.
>>>
general "a" Just
Schema [Just "a"] (Scope (Var (B 0)))
>>>
general ("a" ~> "a") Just
Schema [Just "a"] (Scope (Var (B 0) :-> Var (B 0)))
>>>
general ("a" ~> "b") Just
Schema [Just "a",Just "b"] (Scope (Var (B 0) :-> Var (B 1)))
>>>
general ("b" ~> "a") Just
Schema [Just "b",Just "a"] (Scope (Var (B 0) :-> Var (B 1)))
>>>
general (star ~> star) Just
Schema [] (Scope (Type (HardKind Star) :-> Type (HardKind Star)))
Kind Variables
class HasKindVars s t a b | s -> a, s b -> t, t -> b, t a -> s where Source
Provides a traversal of free kind variables that can be used to perform substitution or extract a free variable set.
HasKindVars s t a b => HasKindVars [s] [t] a b | |
HasKindVars s t a b => HasKindVars (IntMap s) (IntMap t) a b | |
HasKindVars (Schema a) (Schema b) a b | |
HasKindVars (Kind a) (Kind b) a b | |
(HasKindVars s t a b, HasKindVars u v a b) => HasKindVars (s, u) (t, v) a b | |
HasKindVars s t a b => HasKindVars (Map k s) (Map k t) a b | |
HasKindVars (Type k a) (Type k' a) k k' | |
HasKindVars t t' k k' => HasKindVars (Term t a) (Term t' a) k k' | |
HasKindVars (Constructor k t) (Constructor k' t) k k' | |
HasKindVars (DataType k t) (DataType k' t) k k' | |
((~) (* -> *) k Kind, (~) (* -> *) k' Kind, (~) * b b') => HasKindVars (Scope b k a) (Scope b' k' a') a a' | |
HasKindVars t t' v v' => HasKindVars (Witness c t a) (Witness c t' a) v v' |