Created
October 25, 2019 00:42
-
-
Save tonymorris/5917646e3bd39766bf10e10b9c59f82c to your computer and use it in GitHub Desktop.
This file contains 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 Data.Foldable | |
data X' = | |
A | |
| B | |
| C | |
| Z | |
deriving (Eq, Show) | |
data X = | |
Val X' | Add X X | |
deriving (Eq, Show) | |
list (Val x) = [x] | |
list (Add x1 x2) = list x1 ++ list x2 | |
o = Add | |
a = Val A | |
b = Val B | |
c = Val C | |
z = Val Z | |
l = foldl' o z [a, b, c] | |
r = foldr o c [z, a, b] | |
l' = list l | |
r' = list r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment