initial commit

This commit is contained in:
nora 2021-07-08 16:30:07 +02:00
commit 80aa1a2be7
8 changed files with 142 additions and 0 deletions

26
Hello.idr Normal file
View file

@ -0,0 +1,26 @@
module Main
main : IO ()
main = putStrLn "hello world"
StringOrInt : Bool -> Type
StringOrInt x = case x of
True => Int
False => String
getStringOrInt : (x : Bool) -> StringOrInt x
getStringOrInt x = case x of
True => 94
False => "Ninety four"
TypeChooser : String -> Type
TypeChooser x = case x of
"Int" => Int
"Bool" => Bool
"String" => String
"Char" => Char
valToString : (typeChoice : Bool) -> StringOrInt typeChoice -> String
valToString typeChoice val = case typeChoice of
True => cast val -- True means that our argument type is Int, so cast
False => val -- False means that our agumet type is String, so no need to cast