mirror of
https://github.com/Noratrieb/idris-learning.git
synced 2026-01-16 05:55:02 +01:00
move and change
This commit is contained in:
parent
80aa1a2be7
commit
1330cb05e9
10 changed files with 161 additions and 142 deletions
26
Hello.idr
26
Hello.idr
|
|
@ -1,26 +0,0 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue