From 940f03eb0194013545196b6d86bc9c7cd683c2bd Mon Sep 17 00:00:00 2001 From: Nilstrieb Date: Thu, 8 Jul 2021 17:07:02 +0200 Subject: [PATCH] ch3 --- chapter3/PatternMatching.idr | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 chapter3/PatternMatching.idr diff --git a/chapter3/PatternMatching.idr b/chapter3/PatternMatching.idr new file mode 100644 index 0000000..11fe257 --- /dev/null +++ b/chapter3/PatternMatching.idr @@ -0,0 +1,15 @@ +module Main + +surrond_with_braces : String -> String +surrond_with_braces x = "{" ++ x ++ "}" + +allLengths : List String -> List Nat +allLengths strs = map length strs + +invert : Bool -> Bool +invert True = False +invert False = True + +describeList : Show a => List a -> String +describeList [] = "Empty" +describeList (x :: xs) = "Non-empty (" ++ show x ++ "), tail = " ++ show xs