FACSKELL is the Founders & Coders Haskell Club. We are currently learning Haskell by reading CIS 194: Introduction to Haskell (Spring 2013) by Brent Yorgey. We are also learning from other books:
Find and post your questions on Reddit Haskell, Reddit Haskell Questions or on Stackoverflow
For a more detail list of documentation you can have a look at the Haskell website
Because learning Haskell is cool!
Haskell is:
- Functional
- Pure
- Immutable
- No side effects
- A same function with the same arguments will return the same outputs
- Lazy
- Typed
Haskell has the usual types : Bool, Int, Integer, Char, String. The Char type is represented with single quote 'C', the Sting type is represented with double quotes "myString". Haskell has also some more useful types:
- Pairs:
p :: (Int, Char)
- List:
l :: [Integer] -- a list is a head and a tail (x:xs)
You can use the keyword type to create an alias for a type.
type St = String
f :: St -> St
You can create a new type with the keyword data:
data Tree = Empty | Leaf Int | Node Tree Tree
Here we create the type constructor Tree whith the following data constructors:
- Empty
- Leaf Int
- Node Tree Tree
Leaf and Node take parameters! type constructor and data constructor must begin with a capital letter!
You can combine functions:
myOtherFunc (myFirstFunc a)
Two useful operators:
. Which correspond to the mathematic composition. The result of the fist function become the input of the second function
(myOtherFunc . myFirstFunc) a
$ Replace parenthesis. Everything after $ will be executed before the things before the $ (everything after $ has a higher precedence)
myOtherFunc $ myFirstFunc a
Haskell load by default the Prelude module which contains a lot of useful functions
You can find all the documentation of Haskell on Hoogle