Created
November 4, 2017 22:26
-
-
Save ctford/43ba6978712fd30c01ee61da13b3aa0d to your computer and use it in GitHub Desktop.
Fuse a chain of functions
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
module Data.Chain | |
%default total | |
data Chain : Type -> Type -> Type | |
where | |
Link : (a -> b) -> Chain a b | |
Section : (a -> b) -> Chain b c -> Chain a c | |
fuse : Chain a b -> a -> b | |
fuse (Link f) x = f x | |
fuse (Section f g) x = fuse g $ f x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment