Created
September 19, 2021 04:56
-
-
Save cqfd/2aad2620db047ca91f92d64e742897d7 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 Mappers | |
data Identity a = MkIdentity a | |
Functor Identity where | |
map f (MkIdentity x) = MkIdentity (f x) | |
repapply : Nat -> (a -> a) -> (a -> a) | |
repapply Z f = id | |
repapply (S k) f = f . repapply k f | |
mapND : Functor f => (n: Nat) -> (a -> b) -> (repapply n f $ a) -> (repapply n f $ b) | |
mapND 0 g x = g x | |
mapND 1 g x = map g x | |
mapND (S k) g x = (map . mapND k) g x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok! Maybe this is a nicer/smaller version: