Last active
September 11, 2019 17:39
-
-
Save kapranov-anton/86d44e4d382c2c38ffb5d59e331bc93a to your computer and use it in GitHub Desktop.
Broken ana
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 Html | |
type TreeF v a | |
= Node v (List a) | |
treeMap : (a -> b) -> TreeF v a -> TreeF v b | |
treeMap f (Node v xs) = | |
Node v <| List.map f xs | |
type Tree v | |
= Tree (TreeF v (Tree v)) | |
treeAna : (a -> TreeF v a) -> a -> Tree v | |
treeAna alg = | |
Tree << treeMap (treeAna alg) << alg | |
-- treeAna alg a = | |
-- Tree << treeMap (treeAna alg) <| alg a | |
treeCoalgebra : Int -> TreeF Int Int | |
treeCoalgebra a = | |
Node 0 [] | |
main = | |
Html.text <| Debug.toString <| treeAna treeCoalgebra 99 |
Author
kapranov-anton
commented
Sep 11, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment