Hacker News new | ask | show | jobs
by earleybird 1540 days ago
So in essence I could think of types as functions (possibly nullary) from types to types?

Bool = sum(False, True)

Maybe = λ a . sum(Nothing, Just(a))

1 comments

> So in essence I could think of types as functions (possibly nullary) from types to types?

Type constructors, yes. In Haskell the type of type constructors are called kinds:

    λ> :kind Bool
    Bool :: Type
    λ> :kind Maybe
    Maybe :: Type -> Type
    λ> :kind Maybe Int
    Maybe Int :: Type
    λ> :kind Either
    Either :: Type -> Type -> Type
    λ> :kind Eq
    Eq :: Type -> Constraint
    λ> :kind Functor
    Functor :: (Type -> Type) -> Constraint