Created
April 15, 2015 12:00
-
-
Save david-christiansen/5fab089b2ccb41afd7dc 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
module VeryFun | |
class VeryFun (f : Type -> Type) (dict : Functor f) | f where | |
funIdentity : {a : Type} -> (x : f a) -> | |
map @{dict} id x = id x | |
funComposition : {a : Type} -> {b : Type} -> | |
(x : f a) -> (g1 : a -> b) -> (g2 : b -> c) -> | |
map @{dict} (g2 . g1) x = (map @{dict} g2 . map @{dict} g1) x | |
instance VeryFun List %instance where | |
funIdentity [] = Refl | |
funIdentity (x :: xs) = cong $ funIdentity xs | |
funComposition [] g1 g2 = Refl | |
funComposition (x :: xs) g1 g2 = cong $ funComposition xs g1 g2 | |
test : (xs : List Nat) -> map ((+1) . (+2)) xs = map (+1) (map (+2) xs) | |
test xs = funComposition xs (+2) (+1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment