Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Documentation
class (Typeable a, AsType (Ana a)) => Model a where Source #
Class of types whose model can be calculated
Instances are derived automatically, provided that the data type has an instance for Generics
envType :: Proxy a -> State Env HType Source #
Given a type proxy, update the environment with the ADTs referred by it and return the corresponding HType
envType :: (Generic a, GModel (Rep a)) => Proxy a -> State Env HType Source #
Given a type proxy, update the environment with the ADTs referred by it and return the corresponding HType
Helper class used to capture the type parameters
Utilities
useCT :: Typeable a => Maybe (ConTree String HTypeRef) -> proxy a -> State Env (Type (TypeRef QualName)) Source #
Use the given constructors tree as model for the given type, returns the build type Exported so that it can be used to overwrite default definitions
Re-exports
type family Ana t where ... Source #
Abstract a concrete type to a type applied to variables.
More precisely: to a meta-representation where type application is represented by App
, data types are marked by Typ
and variables are represented by ANat
types.
BUG: Silently fails for types with more than 9 parameters (should be defined recursively, if you know how let me know)
Examples:
>>>
undefined :: Ana (Maybe Char)
undefined :: Ana (Maybe Char) :: App (Typ (Maybe A0)) (Typ Char)
>>>
undefined :: Ana (Either Int Char)
undefined :: Ana (Either Int Char) :: App (App (Typ (Either A0 A1)) (Typ Int)) (Typ Char)
>>>
undefined :: Ana ([(Bool,())])
undefined :: Ana ([(Bool,())]) :: App (Typ [A0]) (App (App (Typ (A0, A1)) (Typ Bool)) (Typ ()))
Ana (f a0 a1 a2 a3 a4 a5 a6 a7 a8) = App (App (App (App (App (App (App (App (App (Typ (f A0 A1 A2 A3 A4 A5 A6 A7 A8)) (Ana a0)) (Ana a1)) (Ana a2)) (Ana a3)) (Ana a4)) (Ana a5)) (Ana a6)) (Ana a7)) (Ana a8) | |
Ana (f a0 a1 a2 a3 a4 a5 a6 a7) = App (App (App (App (App (App (App (App (Typ (f A0 A1 A2 A3 A4 A5 A6 A7)) (Ana a0)) (Ana a1)) (Ana a2)) (Ana a3)) (Ana a4)) (Ana a5)) (Ana a6)) (Ana a7) | |
Ana (f a0 a1 a2 a3 a4 a5 a6) = App (App (App (App (App (App (App (Typ (f A0 A1 A2 A3 A4 A5 A6)) (Ana a0)) (Ana a1)) (Ana a2)) (Ana a3)) (Ana a4)) (Ana a5)) (Ana a6) | |
Ana (f a0 a1 a2 a3 a4 a5) = App (App (App (App (App (App (Typ (f A0 A1 A2 A3 A4 A5)) (Ana a0)) (Ana a1)) (Ana a2)) (Ana a3)) (Ana a4)) (Ana a5) | |
Ana (f a0 a1 a2 a3 a4) = App (App (App (App (App (Typ (f A0 A1 A2 A3 A4)) (Ana a0)) (Ana a1)) (Ana a2)) (Ana a3)) (Ana a4) | |
Ana (f a0 a1 a2 a3) = App (App (App (App (Typ (f A0 A1 A2 A3)) (Ana a0)) (Ana a1)) (Ana a2)) (Ana a3) | |
Ana (f a0 a1 a2) = App (App (App (Typ (f A0 A1 A2)) (Ana a0)) (Ana a1)) (Ana a2) | |
Ana (f a0 a1) = App (App (Typ (f A0 A1)) (Ana a0)) (Ana a1) | |
Ana (f a0) = App (Typ (f A0)) (Ana a0) | |
Ana a = Typ a |