A Haskell A Day: Types
Haskell the language has types. Example of defining types:
(+++) :: [a] -> [a] -> [a]  +++ aList = aList (x:bList) +++ aList = x : (bList +++ aList)
Examples of user defined types:
data myBool = False | True data Color = Red | Green | Blue | Indigo | Violet data Point a = Pt a a
Most materials on this page are from: http://www.haskell.org/tutorial/goodies.html
Haskell supports some sequences:
[1..10] → [1,2,3,4,5,6,7,8,9,10] [1,3..10] → [1,3,5,7,9] [1,3..] → [1,3,5,7,9, … (infinite sequence)
some list comprehension stuff. Need to create actual code here.
[ f x | x <- xs ] [ (x,y) | x <- xs, y <- ys ]
Example of defining map.
map :: (a->b) -> [a] -> [b] map f  =  map f (x:xs) = f x : map f xs
Question: how to find out what functions are predefined in Haskell?
Example of using map:
map (add 1) [1,2,3] -- returns [2,3,4]