[Haskell] Haskell [x] and x notation - as-pattern example

Henning Thielemann lemming at henning-thielemann.de
Wed Apr 3 11:15:23 CEST 2013


On Wed, 3 Apr 2013, Angus Comber wrote:

> I am reading Learn you a Haskell for great good and on page 40 - as-patterns.

This question is certainly better for the beginners list:
    http://www.haskell.org/mailman/listinfo/beginners

In your case

    x :: Char
    xs :: [Char]

    [x] :: Char

That is, the brackets create a list from the single character x. This way 
it provides the list type as required by (++).



More information about the Haskell mailing list