diff --git a/sample-programs/basic-1 b/sample-programs/basic-1.crf similarity index 100% rename from sample-programs/basic-1 rename to sample-programs/basic-1.crf diff --git a/sample-programs/basic-2 b/sample-programs/basic-2.crf similarity index 100% rename from sample-programs/basic-2 rename to sample-programs/basic-2.crf diff --git a/sample-programs/basic-3 b/sample-programs/basic-3.crf similarity index 100% rename from sample-programs/basic-3 rename to sample-programs/basic-3.crf diff --git a/sample-programs/basic-4 b/sample-programs/basic-4.crf similarity index 100% rename from sample-programs/basic-4 rename to sample-programs/basic-4.crf diff --git a/sample-programs/basic-5 b/sample-programs/basic-5.crf similarity index 100% rename from sample-programs/basic-5 rename to sample-programs/basic-5.crf diff --git a/sample-programs/basic-6 b/sample-programs/basic-6.crf similarity index 100% rename from sample-programs/basic-6 rename to sample-programs/basic-6.crf diff --git a/sample-programs/basic-7 b/sample-programs/basic-7.crf similarity index 100% rename from sample-programs/basic-7 rename to sample-programs/basic-7.crf diff --git a/sample-programs/basic-8 b/sample-programs/basic-8.crf similarity index 100% rename from sample-programs/basic-8 rename to sample-programs/basic-8.crf diff --git a/sample-programs/basic-9 b/sample-programs/basic-9.crf similarity index 100% rename from sample-programs/basic-9 rename to sample-programs/basic-9.crf diff --git a/test_program.crf b/test_program.crf index 0c7ce1e..1977b7e 100644 --- a/test_program.crf +++ b/test_program.crf @@ -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 ; +};