3
module Introduction.Built-in where
5
{- Agda supports four built-in types :
8
- floating point numbers,
12
Note that strings are not defined as lists of characters (as is the case in
15
To use the built-in types they first have to be bound to Agda types. The
16
reason for this is that there are no predefined names in Agda.
25
{-# BUILTIN INTEGER Int #-}
26
{-# BUILTIN FLOAT Float #-}
27
{-# BUILTIN CHAR Char #-}
28
{-# BUILTIN STRING String #-}
37
hello = "Hello World!"
44
{-# BUILTIN NATURAL Nat #-}
45
{-# BUILTIN SUC suc #-}
46
{-# BUILTIN ZERO zero #-}
52
module FloatPlus where -- We put it in a module to prevent it from clashing with
53
-- the plus function in the complete list of primitive
56
primFloatPlus : Float -> Float -> Float
58
twoPi = primFloatPlus pi pi
65
{-# BUILTIN BOOL Bool #-}
66
{-# BUILTIN TRUE true #-}
67
{-# BUILTIN FALSE false #-}
69
module FloatLess where
72
primFloatLess : Float -> Float -> Bool
75
data List (A : Set) : Set where
77
_::_ : A -> List A -> List A
79
{-# BUILTIN LIST List #-}
80
{-# BUILTIN NIL nil #-}
81
{-# BUILTIN CONS _::_ #-}
83
module StringToList where
86
primStringToList : String -> List Char
92
primIntegerPlus : Int -> Int -> Int
93
primIntegerMinus : Int -> Int -> Int
94
primIntegerTimes : Int -> Int -> Int
95
primIntegerDiv : Int -> Int -> Int -- partial
96
primIntegerMod : Int -> Int -> Int -- partial
97
primIntegerEquality : Int -> Int -> Bool
98
primIntegerLess : Int -> Int -> Bool
99
primIntegerAbs : Int -> Nat
100
primNatToInteger : Nat -> Int
101
primShowInteger : Int -> String
103
-- Floating point functions
104
primIntegerToFloat : Int -> Float
105
primFloatPlus : Float -> Float -> Float
106
primFloatMinus : Float -> Float -> Float
107
primFloatTimes : Float -> Float -> Float
108
primFloatDiv : Float -> Float -> Float
109
primFloatLess : Float -> Float -> Bool
110
primRound : Float -> Int
111
primFloor : Float -> Int
112
primCeiling : Float -> Int
113
primExp : Float -> Float
114
primLog : Float -> Float -- partial
115
primSin : Float -> Float
116
primShowFloat : Float -> String
118
-- Character functions
119
primCharEquality : Char -> Char -> Bool
120
primIsLower : Char -> Bool
121
primIsDigit : Char -> Bool
122
primIsAlpha : Char -> Bool
123
primIsSpace : Char -> Bool
124
primIsAscii : Char -> Bool
125
primIsLatin1 : Char -> Bool
126
primIsPrint : Char -> Bool
127
primIsHexDigit : Char -> Bool
128
primToUpper : Char -> Char
129
primToLower : Char -> Char
130
primCharToNat : Char -> Nat
131
primNatToChar : Nat -> Char -- partial
132
primShowChar : Char -> String
135
primStringToList : String -> List Char
136
primStringFromList : List Char -> String
137
primStringAppend : String -> String -> String
138
primStringEquality : String -> String -> Bool
139
primShowString : String -> String