-
-
Save jccarbonfive/3682372 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Prelude> let sum x y = x + y | |
| Prelude> :type sum | |
| sum :: Num a => a -> a -> a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Prelude> let f = sum 3 | |
| Prelude> :type f | |
| f :: Integer -> Integer | |
| Prelude> f 4 | |
| 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Prelude> let double = (* 2) | |
| Prelude> :type double | |
| double :: Integer -> Integer | |
| Prelude> :type (2 ^) | |
| (2 ^) :: (Integral b, Num a) => b -> a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Prelude> :type map (+ 1) | |
| map (+ 1) :: Num b => [b] -> [b] | |
| Prelude> :type map (\x -> x + 1) | |
| map (\x -> x + 1) :: Num b => [b] -> [b] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Prelude> let s = foldl (+) 0 | |
| Prelude> :type s | |
| s :: [Integer] -> Integer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Prelude> let prod xs = foldl (*) 1 xs | |
| Prelude> prod [1, 2, 3, 4] | |
| 24 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Prelude> let prod = foldl (*) 1 | |
| Prelude> prod [1, 2, 3, 4] | |
| 24 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Prelude> :type "hello" | |
| "hello" :: [Char] | |
| Prelude> :kind [Char] | |
| [Char] :: * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Prelude> :kind Either | |
| Either :: * -> * -> * | |
| Prelude> :kind Either String | |
| Either String :: * -> * | |
| Prelude> :kind Either String Int | |
| Either String Int :: * |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment