[Haskell-beginners] Data.Map: fromList

Stayvoid stayvoid at gmail.com
Tue Sep 11 18:59:37 CEST 2012


I'm reading learnyouahaskell.com.
There is an example: [1]

ghci> Map.fromList
fromList [("betty","555-2938"),("bonnie","452-2928"),("lucille","205-2928")]

Why does Map.fromList represent its output like this?

Could you explain me the following definition?

data Map.Map k a
  = Data.Map.Tip
  | Data.Map.Bin !Data.Map.Size !k a !(Map.Map k a) !(Map.Map k a)

I guess that this fromList example is a bit premature.
The only parameterised type I know is this one:

data Maybe a = Nothing | Just a

[1] http://learnyouahaskell.com/modules#data-map


More information about the Beginners mailing list