Skip to content

Commit

Permalink
map examples
Browse files Browse the repository at this point in the history
  • Loading branch information
cu1ch3n committed Jul 12, 2024
1 parent efa6f41 commit 09908b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions implementation/extra_examples/map1.e
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let map :: forall a. forall b. (a -> b) -> [a] -> [b] =
/\a. (/\b. (\f -> \xs -> case xs of
[] -> [];
(y : ys) -> f y : map f ys) :: (a -> b) -> [a] -> [b])
in map (\x -> 1) (True : False : [])
5 changes: 5 additions & 0 deletions implementation/extra_examples/map2.e
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let map :: forall a. forall b. (a -> b) -> [a] -> [b] =
/\a. (/\b. (\f -> \xs -> case xs of
[] -> [];
(y : ys) -> f y : map f ys) :: (a -> b) -> [a] -> [b])
in map @(Int \/ Bool) ((\x -> 1) :: (Int \/ Bool) -> Int) ((False : 1 : []) :: [Int \/ Bool])

0 comments on commit 09908b9

Please sign in to comment.