Quantcast
Channel: What is [] (list constructor) in Haskell? - Stack Overflow
Browsing latest articles
Browse All 5 View Live

Answer by yfeldblum for What is [] (list constructor) in Haskell?

The type is described (in a GHCI session) as:$ ghciPrelude> :info []data [] a = [] | a : [a] -- Defined We may also think about it as though it were defined as:data List a = Nil | Cons a (List...

View Article



Answer by C. A. McCann for What is [] (list constructor) in Haskell?

Just to make things more explicit, this data type:data List a = Cons a (List a) | Nil...has the same structure as the built-in list type, but without the (nicer, but potentially confusing) special...

View Article

Answer by Don Stewart for What is [] (list constructor) in Haskell?

it is a type constructor (e.g. [Int] is a type), and a data constructor ([2] is a list structure).The empty list is a list holding any type[a] is like Maybe a, [2] is like Just 2.[] is a zero-ary...

View Article

Answer by Doug McClean for What is [] (list constructor) in Haskell?

It's (confusingly, I'll grant you) syntactically overloaded to be both a type constructor and a value constructor.It means that (the value constructor) [] has the type that, for all types a, it is a...

View Article

What is [] (list constructor) in Haskell?

I'm Having problems understanding functors, specifically what a concrete type is in LYAH. I believe this is because I don't understand what [] really is.fmap :: (a -> b) -> f a -> f b Is [], a...

View Article

Browsing latest articles
Browse All 5 View Live


Latest Images