AlonzoPrelude.agda 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. module AlonzoPrelude where
  2. open import RTN public
  3. import RTP -- magic module - Run Time Primitives
  4. Int : Set
  5. Int = RTP.Int
  6. Float : Set
  7. Float = RTP.Float
  8. String : Set
  9. String = RTP.String
  10. Char : Set
  11. Char = RTP.Char
  12. data True : Set where
  13. tt : True
  14. {-
  15. record True : Set where
  16. tt : True
  17. tt = record{}
  18. -}
  19. data False : Set where
  20. elim-False : {A : Set} -> False -> A
  21. elim-False ()
  22. -- _∘_ : {A,B,C:Set} -> (B -> C) -> (A -> B) -> A -> C
  23. -- f ∘ g = \x -> f (g x)
  24. id : {A : Set} -> A -> A
  25. id x = x
  26. infixr 90 _○_
  27. _○_ : {A B C : Set} -> (B -> C) -> (A -> B) -> A -> C
  28. (f ○ g) x = f (g x)
  29. infixr 0 _$_
  30. _$_ : {A B : Set} -> (A -> B) -> A -> B
  31. f $ x = f x
  32. flip : {A B C : Set} -> (A -> B -> C) -> B -> A -> C
  33. flip f x y = f y x
  34. const : {A B : Set} -> A -> B -> A
  35. const x _ = x
  36. typeOf : {A : Set} -> A -> Set
  37. typeOf {A} _ = A
  38. data _×_ (A B : Set) : Set where
  39. <_,_> : A -> B -> A × B
  40. fst : {A B : Set} -> A × B -> A
  41. fst < x , y > = x
  42. snd : {A B : Set} -> A × B -> B
  43. snd < x , y > = y
  44. {-
  45. infixr 10 _::_
  46. data List (A:Set) : Set where
  47. nil : List A
  48. _::_ : A -> List A -> List A
  49. [_] : {A:Set} -> A -> List A
  50. [ x ] = x :: nil
  51. -}
  52. {-# BUILTIN INTEGER Int #-}
  53. -- {-# BUILTIN STRING String #-}
  54. -- {-# BUILTIN FLOAT Float #-}
  55. {-# BUILTIN CHAR Char #-}