Skip to content

Instantly share code, notes, and snippets.

@roberto
Last active November 2, 2015 17:44
Show Gist options
  • Save roberto/6eeed5511da1879bbd31 to your computer and use it in GitHub Desktop.
Save roberto/6eeed5511da1879bbd31 to your computer and use it in GitHub Desktop.
:t True
True :: Bool
:t 1
1 :: Num a => a
:t [(1.2, "b", 'c'), (2.3, "d", 'e')]
[(1.2,"b",'c'),(2.3,"d",'e')] :: Fractional a => [(a,[Char],Char)]
inc :: Num a => a -> a
inc = (+) 1
map inc [1,2,3,4]
if 1 == 2 then True else False
signum n | n > 0 = 1
| n == 0 = 0
| otherwise = -1
True && b = b
False && _ = False
1:2:3:[] == [1,2,3]
head :: [a] -> a
head (x:_) = x
second :: [a] -> a
second (_:x:_) = x
map (\x -> x + 1) [1,2,3,4]
1+ 2
(+) 1 2
(1+) 2
(+2) 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment