[Haskell-beginners] Parametrizing [] as an instance of the Functor type class

Olumide 50295 at web.de
Fri Jan 1 19:17:36 UTC 2016


Can you please give an example of [] used as a type constructor? I'm 
still learning Haskell and don't yet know what kind is. Is it related to 
type constructors?

Regards,

- Olumide

On 31/12/15 13:10, Alexander Berntsen wrote:
>...
> On 31/12/15 14:06, Olumide wrote:
>> Overall, I'm a bit confused about the relationship between the type
>>   constructor f and [].
> f = []. In other words, [] *is* the type constructor.
>
> In Haskell, [] is both the type constructor for lists *and* the term
> level value for an empty list. This is unfortunate. In ghci you can
> see this.
>
> ? :t []
> [] :: [t] -- term level
> ? :k []
> [] :: * -> * -- type level



More information about the Beginners mailing list