Added .crf to every sample-program

This commit is contained in:
Samuel Hammersberg 2023-03-26 18:38:07 +02:00
parent 9ea3a3dc56
commit ccfae19541
10 changed files with 23 additions and 23 deletions

View file

@ -1,28 +1,28 @@
-- data Maybe (a) where {
-- Nothing : Maybe (a)
-- Just : a -> Maybe (a)
-- };
data Maybe () where {
Nothing : Maybe
Just : Int -> Maybe
};
-- fmap : (a -> b) -> Maybe (a) -> Maybe (b) ;
-- fmap f ma = case ma of {
-- Nothing => Nothing ;
-- Just a => Just (f a) ;
-- };
fmap : (Int -> Int) -> Maybe -> Maybe ;
fmap f ma = case ma of {
Nothing => Nothing ;
Just a => Just (f a) ;
};
-- pure : a -> Maybe (a) ;
-- pure x = Just x ;
pure : Int -> Maybe ;
pure x = Just x ;
-- ap mf ma = case mf of {
-- Just f => case ma of {
-- Nothing => Nothing;
-- Just a => Just (f a);
-- };
-- Nothing => Nothing;
-- };
ap mf ma = case mf of {
Just f => case ma of {
Nothing => Nothing;
Just a => Just (f a);
};
Nothing => Nothing;
};
-- return = pure;
return = pure;
-- bind ma f = case ma of {
-- Nothing => Nothing ;
-- Just a => f a ;
-- };
bind ma f = case ma of {
Nothing => Nothing ;
Just a => f a ;
};