[Haskell-beginners] Fwd: Re: Multiple letters between -> ->

Francesco Ariis fa-ml at ariis.it
Sat Nov 25 12:48:32 UTC 2017


On Sat, Nov 25, 2017 at 01:06:03PM +0100, Marcus Manning wrote:
> I do not believe that h is a higher kinded type. What I want to express
> is that a function f could take a type constructor as argument and
> simply returns it, but
> 
> f Maybe
> 
> throws an Error

Hello Marcus,
    you cannot pass type constructors (Maybe) to functions! Only *data*
constructors (Just, Nothing).
Hence the reason why the compiler complains, there is no *data* constructor
named `Maybe`. Even in ghci, to inspect type constructors, we use a
different command

    λ> :type Maybe

    <interactive>:1:1: error:
        • Data constructor not in scope: Maybe
        • Perhaps you meant variable ‘maybe’ (imported from Prelude)
    λ> :kind Maybe
    Maybe :: * -> *



More information about the Beginners mailing list