Created
June 22, 2014 01:39
-
-
Save hughfdjackson/f13b2ca2eaae390b9b2f 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
| import List (foldl, map) | |
| data Acceptable = X { x: Int } | XY { y: Int, x: Int } | |
| list : [Acceptable] | |
| list = [X { x = 10 }, XY { x = 20, y = 10 }] | |
| type Xable a = { a | x: Int } | |
| sumX : [Xable a] -> Int | |
| sumX = foldl (+) 0 . map .x | |
| main = asText <| sumX list |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fails compilation with: