-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Emulation of type-level functions
--
-- This package supports emulation of type-level functions using
-- defunctionalization. All functions whose domain is a subkind of
-- * and whose codomain is * itself can be represented.
@package type-functions
@version 0.0.0.0
module Data.TypeFun
-- | Type-level functions are represented by types. TypeFun is the
-- class of all function representations.
--
-- Note that the (->) instance of TypeFun slightly
-- abuses the type constructor (->). In representations of
-- type-level functions, (->) denotes the lifting of the type
-- constructor (->). That is if r and
-- r' are representations of functions f
-- and f', the type r -> r'
-- represents the function \t -> (f t -> f'
-- t).
class (Kind (Domain fun)) => TypeFun fun where { type family Domain fun; }
-- | Application of type-level functions. App takes a function
-- representation and an argument and returns the corresponding result.
-- | A data type that is isomorphic to the type synonym family App.
newtype WrappedApp fun arg
WrapApp :: (App fun arg) -> WrappedApp fun arg
-- | The inverse of WrapApp.
unwrapApp :: WrappedApp fun arg -> App fun arg
-- | Turns a type-level function into the intersection of all its results.
type Universal fun = forall arg. (Inhabitant (Domain fun) arg) => WrappedApp fun arg
-- | A type Id d represents the type-level identity
-- function whose domain is represented by d.
data Id dom
-- | A type Const d v represents the constant
-- type-level function whose domain is represented by d, and whose
-- result is v.
data Const dom val
instance (Kind dom) => TypeFun (Const dom val)
instance (Kind dom) => TypeFun (Id dom)
instance (Domain fun ~ Domain fun', TypeFun fun, TypeFun fun') => TypeFun (fun -> fun')