on master help sign in
Finished making standard library naming consistent
commitfe569c4e0d1682d5b5e12ec0bc23bcf8d14f47e9 authorAhmad Salim Al-Sibahi <asal@itu.dk> dateThu 25 Sep 2014, 20:15 (12 years ago) parent6faa1ab
30 files changed+264−274
benchmarks/quasigroups/Parser.idr+8−8 benchmarks/quasigroups/Solver.idr+11−11 libs/base/Control/Isomorphism.idr+6−6 libs/base/Data/Bits.idr+2−2 libs/base/Data/BoundedList.idr+4−4 libs/base/Data/Buffer.idr+2−2 libs/base/Data/HVect.idr+9−9 libs/base/Decidable/Order.idr+56−67 libs/base/System/Concurrency/Process.idr+13−13 libs/effects/Effect/Memory.idr+12−12 libs/prelude/Decidable/Equality.idr+7−7 libs/prelude/Prelude.idr+3−3 libs/prelude/Prelude/Bool.idr+4−3 libs/prelude/Prelude/Either.idr+4−4 libs/prelude/Prelude/Fin.idr+44−44 libs/prelude/Prelude/Nat.idr+18−18 libs/prelude/Prelude/Pairs.idr+6−6 libs/prelude/Prelude/Strings.idr+2−2 libs/prelude/Prelude/Vect.idr+14−14 samples/interp-alt.idr+13−13 samples/interp.idr+2−2 src/Idris/AbsSyntaxTree.hs+1−1 test/dsl001/test001.idr+3−3 test/dsl002/Resimp.idr+2−2 test/dsl003/DSLPi.idr+3−3 test/dsl003/expected+1−1 test/primitives003/test038.idr+4−4 test/quasiquote003/NoInfer.idr+2−2 test/reg018/reg018d.idr+3−3 test/reg025/reg025.idr+5−5
benchmarks/quasigroups/Parser.idr+8−8
@@ -24,11 +24,11 @@ parseToken x = map Just (tryParseFin ((cast x) - 1))
2424 where
2525 tryParseFin : Int -> Either String (Fin n)
2626 tryParseFin {n=Z} _ = Left ("Given cell " ++ x ++ " out of range")
27− tryParseFin {n=S k} 0 = return fZ
27+ tryParseFin {n=S k} 0 = return FZ
2828 tryParseFin {n=S k} x =
2929 case tryParseFin {n=k} (x-1) of
3030 Left err => Left err
31− Right fin => return (fS fin)
31+ Right fin => return (FS fin)
3232
3333length : Vect n a -> Nat
3434length {n=n} _ = n
@@ -49,9 +49,9 @@ parseCols {n=S k} row l cs = helper last l
4949 No _ => Left ("Illegal cell " ++ index x cs)
5050
5151 helper : {b : Board (S k)} -> Fin (S k) -> LegalBoard b -> Parser (S k)
52− helper fZ l = step l fZ
53− helper (fS k) l = do
54− (_ ** next) <- step l (fS k)
52+ helper FZ l = step l FZ
53+ helper (FS k) l = do
54+ (_ ** next) <- step l (FS k)
5555 helper (weaken k) next
5656
5757parseRows : (b : Board n) -> LegalBoard b -> Vect n String -> Parser n
@@ -66,9 +66,9 @@ parseRows {n=S k} _ l rs = helper last l
6666 Yes prf => let foo = (replace {P=\n => Vect n String} prf cs) in parseCols i l foo -- TODO: foo shouldn't be needed
6767
6868 helper : {b : Board (S k)} -> Fin (S k) -> LegalBoard b -> Parser (S k)
69− helper fZ l = step fZ l
70− helper (fS k) l = do
71− (_ ** next) <- step (fS k) l
69+ helper FZ l = step FZ l
70+ helper (FS k) l = do
71+ (_ ** next) <- step (FS k) l
7272 helper (weaken k) next
7373
7474parse : String -> Either String (n : Nat ** (b : Board n ** LegalBoard b))
benchmarks/quasigroups/Solver.idr+11−11
@@ -35,8 +35,8 @@ instance Show (Board n) where
3535 show (MkBoard rs) = unlines (map showRow rs)
3636
3737updateAt : Fin n -> Vect n a -> (a -> a) -> Vect n a
38−updateAt fZ (x::xs) f = f x :: xs
39−updateAt (fS i) (x::xs) f = x :: updateAt i xs f
38+updateAt FZ (x::xs) f = f x :: xs
39+updateAt (FS i) (x::xs) f = x :: updateAt i xs f
4040
4141setCell : Board n -> (Fin n, Fin n) -> Fin n -> Board n
4242setCell (MkBoard b) (x, y) value = MkBoard (updateAt y b (\row => updateAt x row (const (Just value))))
@@ -127,18 +127,18 @@ data LegalBoard : Board n -> Type where
127127CompleteBoard : Board n -> Type
128128CompleteBoard b = (LegalBoard b, FullBoard b)
129129
130−indexStep : {i : Fin n} -> {xs : Vect n a} -> {x : a} -> index i xs = index (fS i) (x::xs)
130+indexStep : {i : Fin n} -> {xs : Vect n a} -> {x : a} -> index i xs = index (FS i) (x::xs)
131131indexStep = Refl
132132
133133find : {P : a -> Type} -> ((x : a) -> Dec (P x)) -> (xs : Vect n a)
134134 -> Either (All (\x => Not (P x)) xs) (y : a ** (P y, (i : Fin n ** y = index i xs)))
135135find _ Nil = Left Nil
136136find d (x::xs) with (d x)
137− | Yes prf = Right (x ** (prf, (fZ ** Refl)))
137+ | Yes prf = Right (x ** (prf, (FZ ** Refl)))
138138 | No prf =
139139 case find d xs of
140140 Right (y ** (prf', (i ** prf''))) =>
141− Right (y ** (prf', (fS i ** replace {P=(\x => y = x)} (indexStep {x=x}) prf'')))
141+ Right (y ** (prf', (FS i ** replace {P=(\x => y = x)} (indexStep {x=x}) prf'')))
142142 Left prf' => Left (prf::prf')
143143
144144findEmptyInRow : (xs : Vect n (Cell n)) -> Either (All Filled xs) (i : Fin n ** Empty (index i xs))
@@ -158,11 +158,11 @@ emptyCell (MkBoard rs) =
158158 helper Nil = Left Nil
159159 helper (r::rs) =
160160 case findEmptyInRow r of
161− Right (ci ** pf) => Right (fZ ** (ci ** pf))
161+ Right (ci ** pf) => Right (FZ ** (ci ** pf))
162162 Left prf =>
163163 case helper rs of
164164 Left prf' => Left (prf::prf')
165− Right (ri ** (ci ** pf)) => Right (fS ri ** (ci ** pf))
165+ Right (ri ** (ci ** pf)) => Right (FS ri ** (ci ** pf))
166166
167167
168168tryValue : {b : Board (S n)} -> LegalBoard b -> (c : (Fin (S n), Fin (S n))) -> Empty (getCell b c) -> (v : Fin (S n))
@@ -189,16 +189,16 @@ fillBoard {n=(S n)} b l with (emptyCell b)
189189 Right success => (v, Just success)
190190 Left _ => -- TODO: Prove unsolvable
191191 case v of
192− fS k => tryAll (weaken k)
193− fZ => (v, Nothing)
192+ FS k => tryAll (weaken k)
193+ FZ => (v, Nothing)
194194
195195 %assert_total
196196 recurse : Fin (S n) -> Maybe (b' : Board (S n) ** CompleteBoard b')
197197 recurse start =
198198 case tryAll start of
199199 (_, Nothing) => Nothing
200− (fZ, Just (b' ** l')) => fillBoard b' l'
201− (fS next, Just (b' ** l')) =>
200+ (FZ, Just (b' ** l')) => fillBoard b' l'
201+ (FS next, Just (b' ** l')) =>
202202 case fillBoard b' l' of
203203 Just solution => Just solution
204204 Nothing => recurse (weaken next)
libs/base/Control/Isomorphism.idr+6−6
@@ -268,17 +268,17 @@ eitherMaybeRightMaybe {a} {b} =
268268maybeIsoS : Iso (Maybe (Fin n)) (Fin (S n))
269269maybeIsoS = MkIso forth back fb bf
270270 where forth : Maybe (Fin n) -> Fin (S n)
271− forth Nothing = fZ
272− forth (Just x) = fS x
271+ forth Nothing = FZ
272+ forth (Just x) = FS x
273273 back : Fin (S n) -> Maybe (Fin n)
274− back fZ = Nothing
275− back (fS x) = Just x
274+ back FZ = Nothing
275+ back (FS x) = Just x
276276 bf : (x : Maybe (Fin n)) -> back (forth x) = x
277277 bf Nothing = Refl
278278 bf (Just x) = Refl
279279 fb : (y : Fin (S n)) -> forth (back y) = y
280− fb fZ = Refl
281− fb (fS x) = Refl
280+ fb FZ = Refl
281+ fb (FS x) = Refl
282282
283283finZeroBot : Iso (Fin 0) _|_
284284finZeroBot = MkIso (\x => FalseElim (uninhabited x))
libs/base/Data/Bits.idr+2−2
@@ -437,8 +437,8 @@ bitsToStr x = pack (helper last x)
437437 where
438438 %assert_total
439439 helper : Fin (S n) -> Bits n -> List Char
440− helper fZ _ = []
441− helper (fS x) b = (if getBit x b then '1' else '0') :: helper (weaken x) b
440+ helper FZ _ = []
441+ helper (FS x) b = (if getBit x b then '1' else '0') :: helper (weaken x) b
442442
443443instance Show (Bits n) where
444444 show = bitsToStr
libs/base/Data/BoundedList.idr+4−4
@@ -10,8 +10,8 @@ data BoundedList : Nat -> Type -> Type where
1010
1111||| Compute the length of a list.
1212length : BoundedList n a -> Fin (S n)
13−length [] = fZ
14−length (x :: xs) = fS (length xs)
13+length [] = FZ
14+length (x :: xs) = FS (length xs)
1515
1616--------------------------------------------------------------------------------
1717-- Indexing into bounded lists
@@ -19,8 +19,8 @@ length (x :: xs) = fS (length xs)
1919
2020index : Fin (S n) -> BoundedList n a -> Maybe a
2121index _ [] = Nothing
22−index fZ (x :: _) = Just x
23−index (fS f) (_ :: xs) = index f xs
22+index FZ (x :: _) = Just x
23+index (FS f) (_ :: xs) = index f xs
2424
2525--------------------------------------------------------------------------------
2626-- Adjusting bounds
libs/base/Data/Buffer.idr+2−2
@@ -33,8 +33,8 @@ bitsFromNat Z = 0
3333bitsFromNat (S k) = 1 + bitsFromNat k
3434
3535bitsFromFin : Fin n -> Bits64
36−bitsFromFin fZ = 0
37−bitsFromFin (fS k) = 1 + bitsFromFin k
36+bitsFromFin FZ = 0
37+bitsFromFin (FS k) = 1 + bitsFromFin k
3838
3939||| Allocate an empty Buffer. The size hint can be used to avoid
4040||| unnecessary reallocations and copies under the hood if the
libs/base/Data/HVect.idr+9−9
@@ -13,22 +13,22 @@ data HVect : Vect k Type -> Type where
1313
1414||| Extract an element from an HVect
1515index : (i : Fin k) -> HVect ts -> index i ts
16−index fZ (x::xs) = x
17−index (fS j) (x::xs) = index j xs
16+index FZ (x::xs) = x
17+index (FS j) (x::xs) = index j xs
1818
1919deleteAt : (i : Fin (S l)) -> HVect us -> HVect (deleteAt i us)
20−deleteAt fZ (x::xs) = xs
21−deleteAt {l = S m} (fS j) (x::xs) = x :: deleteAt j xs
22−deleteAt {l = Z} (fS j) (x::xs) = absurd j
20+deleteAt FZ (x::xs) = xs
21+deleteAt {l = S m} (FS j) (x::xs) = x :: deleteAt j xs
22+deleteAt {l = Z} (FS j) (x::xs) = absurd j
2323deleteAt _ [] impossible
2424
2525replaceAt : (i : Fin k) -> t -> HVect ts -> HVect (replaceAt i t ts)
26−replaceAt fZ y (x::xs) = y::xs
27−replaceAt (fS j) y (x::xs) = x :: replaceAt j y xs
26+replaceAt FZ y (x::xs) = y::xs
27+replaceAt (FS j) y (x::xs) = x :: replaceAt j y xs
2828
2929updateAt : (i : Fin k) -> (index i ts -> t) -> HVect ts -> HVect (replaceAt i t ts)
30−updateAt fZ f (x::xs) = f x :: xs
31−updateAt (fS j) f (x::xs) = x :: updateAt j f xs
30+updateAt FZ f (x::xs) = f x :: xs
31+updateAt (FS j) f (x::xs) = x :: updateAt j f xs
3232
3333||| Append two `HVect`s.
3434(++) : HVect ts -> HVect us -> HVect (ts ++ us)
libs/base/Decidable/Order.idr+56−67
@@ -15,7 +15,7 @@ import Decidable.Equality
1515
1616class Preorder t (po : t -> t -> Type) where
1717 total transitive : (a : t) -> (b : t) -> (c : t) -> po a b -> po b c -> po a c
18− total Reflexive : (a : t) -> po a a
18+ total reflexive : (a : t) -> po a a
1919
2020class (Preorder t po) => Poset t (po : t -> t -> Type) where
2121 total antisymmetric : (a : t) -> (b : t) -> po a b -> po b a -> a = b
@@ -48,7 +48,7 @@ maximum x y with (order x y)
4848
4949instance Preorder t ((=) {A = t} {B = t}) where
5050 transitive a b c = trans {a = a} {b = b} {c = c}
51− Reflexive a = Refl
51+ reflexive a = Refl
5252
5353instance Equivalence t ((=) {A = t} {B = t}) where
5454 symmetric a b prf = sym prf
@@ -60,99 +60,88 @@ instance Congruence t f ((=) {A = t} {B = t}) where
6060-- Natural numbers
6161--------------------------------------------------------------------------------
6262
63−data NatLTE : Nat -> Nat -> Type where
64− nEqn : NatLTE n n
65− nLTESm : NatLTE n m -> NatLTE n (S m)
63+total LTEIsTransitive : (m : Nat) -> (n : Nat) -> (o : Nat) ->
64+ LTE m n -> LTE n o ->
65+ LTE m o
66+LTEIsTransitive Z n o LTEZero nlteo = LTEZero
67+LTEIsTransitive (S m) (S n) (S o) (LTESucc mlten) (LTESucc nlteo) = LTESucc (LTEIsTransitive m n o mlten nlteo)
6668
67−total NatLTEIsTransitive : (m : Nat) -> (n : Nat) -> (o : Nat) ->
68− NatLTE m n -> NatLTE n o ->
69− NatLTE m o
70−NatLTEIsTransitive m n n mLTEn (nEqn) = mLTEn
71−NatLTEIsTransitive m n (S o) mLTEn (nLTESm nLTEo)
72− = nLTESm (NatLTEIsTransitive m n o mLTEn nLTEo)
69+total LTEIsReflexive : (n : Nat) -> LTE n n
70+LTEIsReflexive Z = LTEZero
71+LTEIsReflexive (S n) = LTESucc (LTEIsReflexive n)
7372
74−total NatLTEIsReflexive : (n : Nat) -> NatLTE n n
75−NatLTEIsReflexive _ = nEqn
73+instance Preorder Nat LTE where
74+ transitive = LTEIsTransitive
75+ reflexive = LTEIsReflexive
7676
77−instance Preorder Nat NatLTE where
78− transitive = NatLTEIsTransitive
79− Reflexive = NatLTEIsReflexive
77+total LTEIsAntisymmetric : (m : Nat) -> (n : Nat) ->
78+ LTE m n -> LTE n m -> m = n
79+LTEIsAntisymmetric Z Z LTEZero LTEZero = Refl
80+LTEIsAntisymmetric (S n) (S m) (LTESucc mLTEn) (LTESucc nLTEm) with (LTEIsAntisymmetric n m mLTEn nLTEm)
81+ LTEIsAntisymmetric (S n) (S n) (LTESucc mLTEn) (LTESucc nLTEm) | Refl = Refl
8082
81−total NatLTEIsAntisymmetric : (m : Nat) -> (n : Nat) ->
82− NatLTE m n -> NatLTE n m -> m = n
83−NatLTEIsAntisymmetric n n nEqn nEqn = Refl
84−NatLTEIsAntisymmetric n m nEqn (nLTESm _) impossible
85−NatLTEIsAntisymmetric n m (nLTESm _) nEqn impossible
86−NatLTEIsAntisymmetric n m (nLTESm _) (nLTESm _) impossible
8783
88−instance Poset Nat NatLTE where
89− antisymmetric = NatLTEIsAntisymmetric
84+instance Poset Nat LTE where
85+ antisymmetric = LTEIsAntisymmetric
9086
91−total zeroNeverGreater : {n : Nat} -> NatLTE (S n) Z -> _|_
92−zeroNeverGreater {n} (nLTESm _) impossible
93−zeroNeverGreater {n} nEqn impossible
87+total zeroNeverGreater : {n : Nat} -> LTE (S n) Z -> _|_
88+zeroNeverGreater {n} LTEZero impossible
89+zeroNeverGreater {n} (LTESucc _) impossible
9490
95−total zeroAlwaysSmaller : {n : Nat} -> NatLTE Z n
96−zeroAlwaysSmaller {n = Z } = nEqn
97−zeroAlwaysSmaller {n = S k} = nLTESm (zeroAlwaysSmaller {n = k})
91+total zeroAlwaysSmaller : {n : Nat} -> LTE Z n
92+zeroAlwaysSmaller = LTEZero
9893
99−total
100−nGTSm : {n : Nat} -> {m : Nat} -> (NatLTE n m -> _|_) -> NatLTE n (S m) -> _|_
101−nGTSm disprf (nLTESm nLTEm) = FalseElim (disprf nLTEm)
102−nGTSm {n} {m} disprf (nEqn) impossible
94+total ltesuccinjective : {n : Nat} -> {m : Nat} -> (LTE n m -> _|_) -> LTE (S n) (S m) -> _|_
95+ltesuccinjective {n} {m} disprf (LTESucc nLTEm) = FalseElim (disprf nLTEm)
96+ltesuccinjective {n} {m} disprf LTEZero impossible
10397
104−total
105−decideNatLTE : (n : Nat) -> (m : Nat) -> Dec (NatLTE n m)
106−decideNatLTE Z Z = Yes nEqn
107−decideNatLTE (S x) Z = No zeroNeverGreater
108−decideNatLTE x (S y) with (decEq x (S y))
109− | Yes eq = rewrite eq in Yes nEqn
110− | No _ with (decideNatLTE x y)
111− | Yes nLTEm = Yes (nLTESm nLTEm)
112− | No nGTm = No (nGTSm nGTm)
113−
114−instance Decidable [Nat,Nat] NatLTE where
115− decide = decideNatLTE
98+
99+total decideLTE : (n : Nat) -> (m : Nat) -> Dec (LTE n m)
100+decideLTE Z y = Yes LTEZero
101+decideLTE (S x) Z = No zeroNeverGreater
102+decideLTE (S x) (S y) with (decEq (S x) (S y))
103+ | Yes eq = rewrite eq in Yes (reflexive x)
104+ | No _ with (decideLTE x y)
105+ | Yes nLTEm = Yes (LTESucc nLTEm)
106+ | No nGTm = No (ltesuccinjective nGTm)
107+
108+instance Decidable [Nat,Nat] LTE where
109+ decide = decideLTE
116110
117111total
118−lte : (m : Nat) -> (n : Nat) -> Dec (NatLTE m n)
119−lte m n = decide {ts = [Nat,Nat]} {p = NatLTE} m n
112+lte : (m : Nat) -> (n : Nat) -> Dec (LTE m n)
113+lte m n = decide {ts = [Nat,Nat]} {p = LTE} m n
120114
121115total
122−shift : (m : Nat) -> (n : Nat) -> NatLTE m n -> NatLTE (S m) (S n)
123−shift Z Z _ = nEqn
124−shift Z (S Z) _ = nLTESm nEqn
125−shift Z (S (S j)) _ = nLTESm (shift Z (S j) zeroAlwaysSmaller)
126−shift (S k) Z prf = FalseElim (zeroNeverGreater prf)
127−shift (S k) (S k) nEqn = nEqn
128−shift (S k) (S j) (nLTESm prf) = nLTESm (shift (S k) j prf)
129−
130−instance Ordered Nat NatLTE where
131− order Z n = Left zeroAlwaysSmaller
132− order m Z = Right zeroAlwaysSmaller
116+shift : (m : Nat) -> (n : Nat) -> LTE m n -> LTE (S m) (S n)
117+shift m n mLTEn = LTESucc mLTEn
118+
119+instance Ordered Nat LTE where
120+ order Z n = Left LTEZero
121+ order m Z = Right LTEZero
133122 order (S k) (S j) with (order k j)
134123 order (S k) (S j) | Left prf = Left (shift k j prf)
135124 order (S k) (S j) | Right prf = Right (shift j k prf)
136125
137−--------------------------------------------------------------------------------
138−-- Finite numbers
139−--------------------------------------------------------------------------------
126+----------------------------------------------------------------------------------
127+---- Finite numbers
128+----------------------------------------------------------------------------------
140129
141130using (k : Nat)
142131 data FinLTE : Fin k -> Fin k -> Type where
143− FromNatPrf : {m : Fin k} -> {n : Fin k} -> NatLTE (finToNat m) (finToNat n) -> FinLTE m n
132+ FromNatPrf : {m : Fin k} -> {n : Fin k} -> LTE (finToNat m) (finToNat n) -> FinLTE m n
144133
145134 instance Preorder (Fin k) FinLTE where
146135 transitive m n o (FromNatPrf p1) (FromNatPrf p2) =
147− FromNatPrf (NatLTEIsTransitive (finToNat m) (finToNat n) (finToNat o) p1 p2)
148− Reflexive n = FromNatPrf (NatLTEIsReflexive (finToNat n))
136+ FromNatPrf (LTEIsTransitive (finToNat m) (finToNat n) (finToNat o) p1 p2)
137+ reflexive n = FromNatPrf (LTEIsReflexive (finToNat n))
149138
150139 instance Poset (Fin k) FinLTE where
151140 antisymmetric m n (FromNatPrf p1) (FromNatPrf p2) =
152− finToNatInjective m n (NatLTEIsAntisymmetric (finToNat m) (finToNat n) p1 p2)
141+ finToNatInjective m n (LTEIsAntisymmetric (finToNat m) (finToNat n) p1 p2)
153142
154143 instance Decidable [Fin k, Fin k] FinLTE where
155− decide m n with (decideNatLTE (finToNat m) (finToNat n))
144+ decide m n with (decideLTE (finToNat m) (finToNat n))
156145 | Yes prf = Yes (FromNatPrf prf)
157146 | No disprf = No (\ (FromNatPrf prf) => disprf prf)
158147
libs/base/System/Concurrency/Process.idr+13−13
@@ -12,38 +12,38 @@ data ProcID msg = MkPID Ptr
1212||| Type safe message passing programs. Parameterised over the type of
1313||| message which can be send, and the return type.
1414data Process : (msgType : Type) -> Type -> Type where
15− lift : IO a -> Process msg a
15+ Lift : IO a -> Process msg a
1616
1717instance Functor (Process msg) where
18− map f (lift a) = lift (map f a)
18+ map f (Lift a) = Lift (map f a)
1919
2020instance Applicative (Process msg) where
21− pure = lift . return
22− (lift f) <$> (lift a) = lift (f <$> a)
21+ pure = Lift . return
22+ (Lift f) <$> (Lift a) = Lift (f <$> a)
2323
2424instance Monad (Process msg) where
25− (lift io) >>= k = lift (do x <- io
25+ (Lift io) >>= k = Lift (do x <- io
2626 case k x of
27− lift v => v)
27+ Lift v => v)
2828
2929run : Process msg x -> IO x
30−run (lift prog) = prog
30+run (Lift prog) = prog
3131
3232||| Get current process ID
3333myID : Process msg (ProcID msg)
34−myID = lift (return (MkPID prim__vm))
34+myID = Lift (return (MkPID prim__vm))
3535
3636||| Send a message to another process
3737send : ProcID msg -> msg -> Process msg ()
38−send (MkPID p) m = lift (sendToThread p (prim__vm, m))
38+send (MkPID p) m = Lift (sendToThread p (prim__vm, m))
3939
4040||| Return whether a message is waiting in the queue
4141msgWaiting : Process msg Bool
42−msgWaiting = lift checkMsgs
42+msgWaiting = Lift checkMsgs
4343
4444||| Receive a message - blocks if there is no message waiting
4545recv : Process msg msg
46−recv {msg} = do (senderid, m) <- lift get
46+recv {msg} = do (senderid, m) <- Lift get
4747 return m
4848 where get : IO (Ptr, msg)
4949 get = getMsg
@@ -51,11 +51,11 @@ recv {msg} = do (senderid, m) <- lift get
5151||| receive a message, and return with the sender's process ID.
5252recvWithSender : Process msg (ProcID msg, msg)
5353recvWithSender {msg}
54− = do (senderid, m) <- lift get
54+ = do (senderid, m) <- Lift get
5555 return (MkPID senderid, m)
5656 where get : IO (Ptr, msg)
5757 get = getMsg
5858
5959create : Process msg () -> Process msg (ProcID msg)
60−create (lift p) = do ptr <- lift (fork p)
60+create (Lift p) = do ptr <- Lift (fork p)
6161 return (MkPID ptr)
libs/effects/Effect/Memory.idr+12−12
@@ -16,23 +16,23 @@ data RawMemory : Effect where
1616 Free : RawMemory () (MemoryChunk n i) (\v => ())
1717 Initialize : Bits8 ->
1818 (size : Nat) ->
19− so (i + size <= n) ->
19+ So (i + size <= n) ->
2020 RawMemory () (MemoryChunk n i) (\v => MemoryChunk n (i + size))
2121 Peek : (offset : Nat) ->
2222 (size : Nat) ->
23− so (offset + size <= i) ->
23+ So (offset + size <= i) ->
2424 RawMemory (Vect size Bits8)
2525 (MemoryChunk n i) (\v => MemoryChunk n i)
2626 Poke : (offset : Nat) ->
2727 (Vect size Bits8) ->
28− so (offset <= i && offset + size <= n) ->
28+ So (offset <= i && offset + size <= n) ->
2929 RawMemory () (MemoryChunk n i) (\v => MemoryChunk n (max i (offset + size)))
3030 Move : (src : MemoryChunk src_size src_init) ->
3131 (dst_offset : Nat) ->
3232 (src_offset : Nat) ->
3333 (size : Nat) ->
34− so (dst_offset <= dst_init && dst_offset + size <= dst_size) ->
35− so (src_offset + size <= src_init) ->
34+ So (dst_offset <= dst_init && dst_offset + size <= dst_size) ->
35+ So (src_offset + size <= src_init) ->
3636 RawMemory () (MemoryChunk dst_size dst_init)
3737 (\v => MemoryChunk dst_size (max dst_init (dst_offset + size)))
3838 GetRawPtr : RawMemory (MemoryChunk n i) (MemoryChunk n i) (\v => MemoryChunk n i)
@@ -108,7 +108,7 @@ initialize : {i : Nat} ->
108108 {n : Nat} ->
109109 Bits8 ->
110110 (size : Nat) ->
111− so (i + size <= n) ->
111+ So (i + size <= n) ->
112112 Eff () [RAW_MEMORY (MemoryChunk n i)]
113113 (\v => [RAW_MEMORY (MemoryChunk n (i + size))])
114114initialize c size prf = call $ Initialize c size prf
@@ -119,7 +119,7 @@ free = call Free
119119peek : {i : Nat} ->
120120 (offset : Nat) ->
121121 (size : Nat) ->
122− so (offset + size <= i) ->
122+ So (offset + size <= i) ->
123123 { [RAW_MEMORY (MemoryChunk n i)] } Eff (Vect size Bits8)
124124peek offset size prf = call $ Peek offset size prf
125125
@@ -127,7 +127,7 @@ poke : {n : Nat} ->
127127 {i : Nat} ->
128128 (offset : Nat) ->
129129 Vect size Bits8 ->
130− so (offset <= i && offset + size <= n) ->
130+ So (offset <= i && offset + size <= n) ->
131131 Eff () [RAW_MEMORY (MemoryChunk n i)]
132132 (\v => [RAW_MEMORY (MemoryChunk n (max i (offset + size)))])
133133poke offset content prf = call $ Poke offset content prf
@@ -144,8 +144,8 @@ move' : {dst_size : Nat} ->
144144 (dst_offset : Nat) ->
145145 (src_offset : Nat) ->
146146 (size : Nat) ->
147− so (dst_offset <= dst_init && dst_offset + size <= dst_size) ->
148− so (src_offset + size <= src_init) ->
147+ So (dst_offset <= dst_init && dst_offset + size <= dst_size) ->
148+ So (src_offset + size <= src_init) ->
149149 Eff () [RAW_MEMORY (MemoryChunk dst_size dst_init)]
150150 (\v => [RAW_MEMORY (MemoryChunk dst_size (max dst_init (dst_offset + size)))])
151151move' src_ptr dst_offset src_offset size dst_bounds src_bounds
@@ -160,8 +160,8 @@ move : {dst_size : Nat} ->
160160 (dst_offset : Nat) ->
161161 (src_offset : Nat) ->
162162 (size : Nat) ->
163− so (dst_offset <= dst_init && dst_offset + size <= dst_size) ->
164− so (src_offset + size <= src_init) ->
163+ So (dst_offset <= dst_init && dst_offset + size <= dst_size) ->
164+ So (src_offset + size <= src_init) ->
165165 Eff ()
166166 [ Dst ::: RAW_MEMORY (MemoryChunk dst_size dst_init)
167167 , Src ::: RAW_MEMORY (MemoryChunk src_size src_init)]
libs/prelude/Decidable/Equality.idr+7−7
@@ -96,16 +96,16 @@ instance (DecEq a, DecEq b) => DecEq (Either a b) where
9696-- Fin
9797--------------------------------------------------------------------------------
9898
99−total fZNotfS : {f : Fin n} -> fZ {k = n} = fS f -> _|_
100−fZNotfS Refl impossible
99+total FZNotFS : {f : Fin n} -> FZ {k = n} = FS f -> _|_
100+FZNotFS Refl impossible
101101
102102instance DecEq (Fin n) where
103− decEq fZ fZ = Yes Refl
104− decEq fZ (fS f) = No fZNotfS
105− decEq (fS f) fZ = No $ negEqSym fZNotfS
106− decEq (fS f) (fS f') with (decEq f f')
103+ decEq FZ FZ = Yes Refl
104+ decEq FZ (FS f) = No FZNotFS
105+ decEq (FS f) FZ = No $ negEqSym FZNotFS
106+ decEq (FS f) (FS f') with (decEq f f')
107107 | Yes p = Yes $ cong p
108− | No p = No $ \h => p $ fSinjective {f = f} {f' = f'} h
108+ | No p = No $ \h => p $ FSinjective {f = f} {f' = f'} h
109109
110110--------------------------------------------------------------------------------
111111-- Tuple
libs/prelude/Prelude.idr+3−3
@@ -420,9 +420,9 @@ instance Enum Int where
420420 go (x :: xs) = n + (cast x * inc) :: go xs
421421
422422instance Enum (Fin (S n)) where
423− pred fZ = fZ
424− pred (fS n) = weaken n
425− succ n = case strengthen (fS n) of
423+ pred FZ = FZ
424+ pred (FS n) = weaken n
425+ succ n = case strengthen (FS n) of
426426 Left _ => last
427427 Right k => k
428428 toNat n = cast n
libs/prelude/Prelude/Bool.idr+4−3
@@ -24,10 +24,11 @@ boolElim False t e = e
2424||| If you find yourself using `so` for something other than primitive types,
2525||| it may be appropriate to define a type of evidence for the property that you
2626||| care about instead.
27−data so : Bool -> Type where oh : so True
27+data So : Bool -> Type where
28+ Oh : So True
2829
29−instance Uninhabited (so False) where
30− uninhabited oh impossible
30+instance Uninhabited (So False) where
31+ uninhabited Oh impossible
3132
3233-- Syntactic sugar for boolean elimination.
3334syntax if [test] then [t] else [e] = boolElim test (Delay t) (Delay e)
libs/prelude/Prelude/Either.idr+4−4
@@ -30,10 +30,10 @@ isRight (Right r) = True
3030-- Misc.
3131--------------------------------------------------------------------------------
3232
33−||| Perform a case analysis on a Boolean, providing clients with a `so` proof
34−choose : (b : Bool) -> Either (so b) (so (not b))
35−choose True = Left oh
36−choose False = Right oh
33+||| Perform a case analysis on a Boolean, providing clients with a `So` proof
34+choose : (b : Bool) -> Either (So b) (So (not b))
35+choose True = Left Oh
36+choose False = Right Oh
3737
3838||| Simply-typed eliminator for Either
3939||| @ f the action to take on Left
libs/prelude/Prelude/Fin.idr+44−44
@@ -12,39 +12,39 @@ import Prelude.Uninhabited
1212||| exceedingly inefficient at run time.
1313||| @ n the upper bound
1414data Fin : (n : Nat) -> Type where
15− fZ : Fin (S k)
16− fS : Fin k -> Fin (S k)
15+ FZ : Fin (S k)
16+ FS : Fin k -> Fin (S k)
1717
1818instance Uninhabited (Fin Z) where
19− uninhabited fZ impossible
20− uninhabited (fS f) impossible
19+ uninhabited FZ impossible
20+ uninhabited (FS f) impossible
2121
22−fSInjective : (m : Fin k) -> (n : Fin k) -> fS m = fS n -> m = n
23−fSInjective left _ Refl = Refl
22+FSInjective : (m : Fin k) -> (n : Fin k) -> FS m = FS n -> m = n
23+FSInjective left _ Refl = Refl
2424
2525instance Eq (Fin n) where
26− (==) fZ fZ = True
27− (==) (fS k) (fS k') = k == k'
26+ (==) FZ FZ = True
27+ (==) (FS k) (FS k') = k == k'
2828 (==) _ _ = False
2929
3030||| There are no elements of `Fin Z`
3131FinZAbsurd : Fin Z -> _|_
32−FinZAbsurd fZ impossible
32+FinZAbsurd FZ impossible
3333
3434FinZElim : Fin Z -> a
3535FinZElim x = FalseElim (FinZAbsurd x)
3636
3737||| Convert a Fin to a Nat
3838finToNat : Fin n -> Nat
39−finToNat fZ = Z
40−finToNat (fS k) = S (finToNat k)
39+finToNat FZ = Z
40+finToNat (FS k) = S (finToNat k)
4141
4242||| `finToNat` is injective
4343finToNatInjective : (fm : Fin k) -> (fn : Fin k) -> (finToNat fm) = (finToNat fn) -> fm = fn
44−finToNatInjective fZ fZ Refl = Refl
45−finToNatInjective (fS m) fZ Refl impossible
46−finToNatInjective fZ (fS n) Refl impossible
47−finToNatInjective (fS m) (fS n) prf =
44+finToNatInjective FZ FZ Refl = Refl
45+finToNatInjective (FS m) FZ Refl impossible
46+finToNatInjective FZ (FS n) Refl impossible
47+finToNatInjective (FS m) (FS n) prf =
4848 cong (finToNatInjective m n (succInjective (finToNat m) (finToNat n) prf))
4949
5050instance Cast (Fin n) Nat where
@@ -52,29 +52,29 @@ instance Cast (Fin n) Nat where
5252
5353||| Convert a Fin to an Integer
5454finToInteger : Fin n -> Integer
55−finToInteger fZ = 0
56−finToInteger (fS k) = 1 + finToInteger k
55+finToInteger FZ = 0
56+finToInteger (FS k) = 1 + finToInteger k
5757
5858instance Cast (Fin n) Integer where
5959 cast x = finToInteger x
6060
6161||| Weaken the bound on a Fin by 1
6262weaken : Fin n -> Fin (S n)
63−weaken fZ = fZ
64−weaken (fS k) = fS (weaken k)
63+weaken FZ = FZ
64+weaken (FS k) = FS (weaken k)
6565
6666||| Weaken the bound on a Fin by some amount
6767weakenN : (n : Nat) -> Fin m -> Fin (m + n)
68−weakenN n fZ = fZ
69−weakenN n (fS f) = fS (weakenN n f)
68+weakenN n FZ = FZ
69+weakenN n (FS f) = FS (weakenN n f)
7070
7171||| Attempt to tighten the bound on a Fin.
7272||| Return `Left` if the bound could not be tightened, or `Right` if it could.
7373strengthen : Fin (S n) -> Either (Fin (S n)) (Fin n)
74−strengthen {n = S k} fZ = Right fZ
75−strengthen {n = S k} (fS i) with (strengthen i)
76− strengthen (fS k) | Left x = Left (fS x)
77− strengthen (fS k) | Right x = Right (fS x)
74+strengthen {n = S k} FZ = Right FZ
75+strengthen {n = S k} (FS i) with (strengthen i)
76+ strengthen (FS k) | Left x = Left (FS x)
77+ strengthen (FS k) | Right x = Right (FS x)
7878strengthen f = Left f
7979
8080||| Add some natural number to a Fin, extending the bound accordingly
@@ -82,24 +82,24 @@ strengthen f = Left f
8282||| @ m the number to increase the Fin by
8383shift : (m : Nat) -> Fin n -> Fin (m + n)
8484shift Z f = f
85−shift {n=n} (S m) f = fS {k = (m + n)} (shift m f)
85+shift {n=n} (S m) f = FS {k = (m + n)} (shift m f)
8686
8787||| The largest element of some Fin type
8888last : Fin (S n)
89−last {n=Z} = fZ
90−last {n=S _} = fS last
89+last {n=Z} = FZ
90+last {n=S _} = FS last
9191
92−total fSinjective : {f : Fin n} -> {f' : Fin n} -> (fS f = fS f') -> f = f'
93−fSinjective Refl = Refl
92+total FSinjective : {f : Fin n} -> {f' : Fin n} -> (FS f = FS f') -> f = f'
93+FSinjective Refl = Refl
9494
9595instance Ord (Fin n) where
96− compare fZ fZ = EQ
97− compare fZ (fS _) = LT
98− compare (fS _) fZ = GT
99− compare (fS x) (fS y) = compare x y
96+ compare FZ FZ = EQ
97+ compare FZ (FS _) = LT
98+ compare (FS _) FZ = GT
99+ compare (FS x) (FS y) = compare x y
100100
101101instance MinBound (Fin (S n)) where
102− minBound = fZ
102+ minBound = FZ
103103
104104instance MaxBound (Fin (S n)) where
105105 maxBound = last
@@ -107,28 +107,28 @@ instance MaxBound (Fin (S n)) where
107107
108108||| Add two Fins, extending the bound
109109(+) : Fin n -> Fin m -> Fin (n + m)
110−(+) {n=S n} {m=m} fZ f' = rewrite plusCommutative n m in weaken (weakenN n f')
111−(+) (fS f) f' = fS (f + f')
110+(+) {n=S n} {m=m} FZ f' = rewrite plusCommutative n m in weaken (weakenN n f')
111+(+) (FS f) f' = FS (f + f')
112112
113113||| Substract two Fins, keeping the bound of the minuend
114114(-) : Fin n -> Fin m -> Fin n
115−fZ - _ = fZ
116−f - fZ = f
117−(fS f) - (fS f') = weaken $ f - f'
115+FZ - _ = FZ
116+f - FZ = f
117+(FS f) - (FS f') = weaken $ f - f'
118118
119119||| Multiply two Fins, extending the bound
120120(*) : Fin n -> Fin m -> Fin (n * m)
121121(*) {n=Z} f f' = FinZElim f
122122(*) {m=Z} f f' = FinZElim f'
123−(*) {n=S n} {m=S m} fZ f' = fZ
124−(*) {n=S n} {m=S m} (fS f) f' = f' + (f * f')
123+(*) {n=S n} {m=S m} FZ f' = FZ
124+(*) {n=S n} {m=S m} (FS f) f' = f' + (f * f')
125125
126126-- Construct a Fin from an integer literal which must fit in the given Fin
127127
128128natToFin : Nat -> (n : Nat) -> Maybe (Fin n)
129−natToFin Z (S j) = Just fZ
129+natToFin Z (S j) = Just FZ
130130natToFin (S k) (S j) with (natToFin k j)
131− | Just k' = Just (fS k')
131+ | Just k' = Just (FS k')
132132 | Nothing = Nothing
133133natToFin _ _ = Nothing
134134
libs/prelude/Prelude/Nat.idr+18−18
@@ -94,9 +94,9 @@ hyper (S pn) a (S pb) = hyper pn a (hyper (S pn) a pb)
9494||| @ m the larger number
9595data LTE : (n, m : Nat) -> Type where
9696 ||| Zero is the smallest Nat
97− lteZero : LTE Z right
97+ LTEZero : LTE Z right
9898 ||| If n <= m, then n + 1 <= m + 1
99− lteSucc : LTE left right -> LTE (S left) (S right)
99+ LTESucc : LTE left right -> LTE (S left) (S right)
100100
101101||| Greater than or equal to
102102total GTE : Nat -> Nat -> Type
@@ -112,18 +112,18 @@ GT left right = LT right left
112112
113113||| A successor is never less than or equal zero
114114succNotLTEzero : Not (S m `LTE` Z)
115−succNotLTEzero lteZero impossible
115+succNotLTEzero LTEZero impossible
116116
117117||| If two numbers are ordered, their predecessors are too
118118fromLteSucc : (S m `LTE` S n) -> (m `LTE` n)
119−fromLteSucc (lteSucc x) = x
119+fromLteSucc (LTESucc x) = x
120120
121121||| A decision procedure for `LTE`
122122isLTE : (m, n : Nat) -> Dec (m `LTE` n)
123−isLTE Z n = Yes lteZero
123+isLTE Z n = Yes LTEZero
124124isLTE (S k) Z = No succNotLTEzero
125125isLTE (S k) (S j) with (isLTE k j)
126− isLTE (S k) (S j) | (Yes prf) = Yes (lteSucc prf)
126+ isLTE (S k) (S j) | (Yes prf) = Yes (LTESucc prf)
127127 isLTE (S k) (S j) | (No contra) = No (contra . fromLteSucc)
128128
129129||| Boolean test than one Nat is less than or equal to another
@@ -329,18 +329,18 @@ lcm x y = divNat (x * y) (gcd x y)
329329-- An informative comparison view
330330--------------------------------------------------------------------------------
331331data CmpNat : Nat -> Nat -> Type where
332− cmpLT : (y : _) -> CmpNat x (x + S y)
333− cmpEQ : CmpNat x x
334− cmpGT : (x : _) -> CmpNat (y + S x) y
332+ CmpLT : (y : _) -> CmpNat x (x + S y)
333+ CmpEQ : CmpNat x x
334+ CmpGT : (x : _) -> CmpNat (y + S x) y
335335
336336total cmp : (x, y : Nat) -> CmpNat x y
337−cmp Z Z = cmpEQ
338−cmp Z (S k) = cmpLT _
339−cmp (S k) Z = cmpGT _
337+cmp Z Z = CmpEQ
338+cmp Z (S k) = CmpLT _
339+cmp (S k) Z = CmpGT _
340340cmp (S x) (S y) with (cmp x y)
341− cmp (S x) (S (x + (S k))) | cmpLT k = cmpLT k
342− cmp (S x) (S x) | cmpEQ = cmpEQ
343− cmp (S (y + (S k))) (S y) | cmpGT k = cmpGT k
341+ cmp (S x) (S (x + (S k))) | CmpLT k = CmpLT k
342+ cmp (S x) (S x) | CmpEQ = CmpEQ
343+ cmp (S (y + (S k))) (S y) | CmpGT k = CmpGT k
344344
345345--------------------------------------------------------------------------------
346346-- Properties
@@ -626,9 +626,9 @@ total lteNTrue : (n : Nat) -> lte n n = True
626626lteNTrue Z = Refl
627627lteNTrue (S n) = lteNTrue n
628628
629−total lteSuccZeroFalse : (n : Nat) -> lte (S n) Z = False
630−lteSuccZeroFalse Z = Refl
631−lteSuccZeroFalse (S n) = Refl
629+total LTESuccZeroFalse : (n : Nat) -> lte (S n) Z = False
630+LTESuccZeroFalse Z = Refl
631+LTESuccZeroFalse (S n) = Refl
632632
633633-- Minimum and maximum
634634total maximumAssociative : (l,c,r : Nat) -> maximum l (maximum c r) = maximum (maximum l c) r
libs/prelude/Prelude/Pairs.idr+6−6
@@ -9,27 +9,27 @@ using (a : Type, P : a -> Type)
99
1010 ||| Dependent pair where the first field is erased.
1111 data Exists : (P : a -> Type) -> Type where
12− evidence : .(x : a) -> (pf : P x) -> Exists P
12+ Evidence : .(x : a) -> (pf : P x) -> Exists P
1313
1414 ||| Dependent pair where the second field is erased.
1515 data Subset : (a : Type) -> (P : a -> Type) -> Type where
16− element : (x : a) -> .(pf : P x) -> Subset a P
16+ Element : (x : a) -> .(pf : P x) -> Subset a P
1717
1818 -- Monomorphic projections
1919
2020 namespace Exists
2121 getWitness : Exists {a} P -> a
22− getWitness (evidence x pf) = x
22+ getWitness (Evidence x pf) = x
2323
2424 getProof : (x : Exists {a} P) -> P (getWitness x)
25− getProof (evidence x pf) = pf
25+ getProof (Evidence x pf) = pf
2626
2727 namespace Subset
2828 getWitness : Subset a P -> a
29− getWitness (element x pf) = x
29+ getWitness (Element x pf) = x
3030
3131 getProof : (x : Subset a P) -> P (getWitness x)
32− getProof (element x pf) = pf
32+ getProof (Element x pf) = pf
3333
3434 namespace Sigma
3535 getWitness : Sigma a P -> a
libs/prelude/Prelude/Strings.idr+2−2
@@ -74,11 +74,11 @@ data StrM : String -> Type where
7474 StrCons : (x : Char) -> (xs : String) -> StrM (strCons x xs)
7575
7676||| Version of 'strHead' that statically verifies that the string is not empty.
77−strHead' : (x : String) -> so (not (x == "")) -> Char
77+strHead' : (x : String) -> So (not (x == "")) -> Char
7878strHead' x p = assert_total $ prim__strHead x
7979
8080||| Version of 'strTail' that statically verifies that the string is not empty.
81−strTail' : (x : String) -> so (not (x == "")) -> String
81+strTail' : (x : String) -> So (not (x == "")) -> String
8282strTail' x p = assert_total $ prim__strTail x
8383
8484-- we need the 'believe_me' because the operations are primitives
libs/prelude/Prelude/Vect.idr+14−14
@@ -64,35 +64,35 @@ init (x::y::ys) = x :: init (y::ys)
6464
6565||| Extract a particular element from a vector
6666index : Fin n -> Vect n a -> a
67−index fZ (x::xs) = x
68−index (fS k) (x::xs) = index k xs
69−index fZ [] impossible
67+index FZ (x::xs) = x
68+index (FS k) (x::xs) = index k xs
69+index FZ [] impossible
7070
7171||| Insert an element at a particular index
7272insertAt : Fin (S n) -> a -> Vect n a -> Vect (S n) a
73−insertAt fZ y xs = y :: xs
74−insertAt (fS k) y (x::xs) = x :: insertAt k y xs
75−insertAt (fS k) y [] = absurd k
73+insertAt FZ y xs = y :: xs
74+insertAt (FS k) y (x::xs) = x :: insertAt k y xs
75+insertAt (FS k) y [] = absurd k
7676
7777||| Construct a new vector consisting of all but the indicated element
7878deleteAt : Fin (S n) -> Vect (S n) a -> Vect n a
79−deleteAt fZ (x::xs) = xs
80−deleteAt {n = S m} (fS k) (x::xs) = x :: deleteAt k xs
81−deleteAt {n = Z} (fS k) (x::xs) = absurd k
79+deleteAt FZ (x::xs) = xs
80+deleteAt {n = S m} (FS k) (x::xs) = x :: deleteAt k xs
81+deleteAt {n = Z} (FS k) (x::xs) = absurd k
8282deleteAt _ [] impossible
8383
8484||| Replace an element at a particlar index with another
8585replaceAt : Fin n -> t -> Vect n t -> Vect n t
86−replaceAt fZ y (x::xs) = y :: xs
87−replaceAt (fS k) y (x::xs) = x :: replaceAt k y xs
86+replaceAt FZ y (x::xs) = y :: xs
87+replaceAt (FS k) y (x::xs) = x :: replaceAt k y xs
8888
8989||| Replace the element at a particular index with the result of applying a function to it
9090||| @ i the index to replace at
9191||| @ f the update function
9292||| @ xs the vector to replace in
9393updateAt : (i : Fin n) -> (f : t -> t) -> (xs : Vect n t) -> Vect n t
94−updateAt fZ f (x::xs) = f x :: xs
95−updateAt (fS k) f (x::xs) = x :: updateAt k f xs
94+updateAt FZ f (x::xs) = f x :: xs
95+updateAt (FS k) f (x::xs) = x :: updateAt k f xs
9696
9797--------------------------------------------------------------------------------
9898-- Subvectors
@@ -456,7 +456,7 @@ diag ((x::xs)::xss) = x :: diag (map tail xss)
456456
457457range : Vect n (Fin n)
458458range {n=Z} = []
459−range {n=S _} = fZ :: map fS range
459+range {n=S _} = FZ :: map FS range
460460
461461||| Transpose a Vect of Vects, turning rows into columns and vice versa.
462462|||
samples/interp-alt.idr+13−13
@@ -14,12 +14,12 @@ using (G : Vect n Ty)
1414 (::) : interpTy a -> Env G -> Env (a :: G)
1515
1616-- data HasType : (i : Fin n) -> Vect n Ty -> Ty -> Type where
17−-- stop : HasType fZ (t :: G) t
18−-- pop : HasType k G t -> HasType (fS k) (u :: G) t
17+-- stop : HasType FZ (t :: G) t
18+-- pop : HasType k G t -> HasType (FS k) (u :: G) t
1919
2020 lookup : (i:Fin n) -> Env G -> interpTy (index i G)
21− lookup fZ (x :: xs) = x
22− lookup (fS i) (x :: xs) = lookup i xs
21+ lookup FZ (x :: xs) = x
22+ lookup (FS i) (x :: xs) = lookup i xs
2323
2424 data Expr : Vect n Ty -> Ty -> Type where
2525 Var : (i : Fin n) -> Expr G (index i G)
@@ -41,32 +41,32 @@ using (G : Vect n Ty)
4141 interp env (Bind v f) = interp env (f (interp env v))
4242
4343 eId : Expr G (TyFun TyInt TyInt)
44− eId = Lam (Var fZ)
44+ eId = Lam (Var FZ)
4545
4646 eTEST : Expr G (TyFun TyInt (TyFun TyInt TyInt))
47− eTEST = Lam (Lam (Var (fS fZ)))
47+ eTEST = Lam (Lam (Var (FS FZ)))
4848
4949 eAdd : Expr G (TyFun TyInt (TyFun TyInt TyInt))
50− eAdd = Lam (Lam (Op prim__addInt (Var fZ) (Var (fS fZ))))
50+ eAdd = Lam (Lam (Op prim__addInt (Var FZ) (Var (FS FZ))))
5151
5252-- eDouble : Expr G (TyFun TyInt TyInt)
53−-- eDouble = Lam (App (App (Lam (Lam (Op' (+) (Var fZ) (Var (fS fZ))))) (Var fZ)) (Var fZ))
53+-- eDouble = Lam (App (App (Lam (Lam (Op' (+) (Var FZ) (Var (FS FZ))))) (Var FZ)) (Var FZ))
5454
5555 eDouble : Expr G (TyFun TyInt TyInt)
56− eDouble = Lam (App (App eAdd (Var fZ)) (Var fZ))
56+ eDouble = Lam (App (App eAdd (Var FZ)) (Var FZ))
5757
5858 app : |(f : Expr G (TyFun a t)) -> Expr G a -> Expr G t
5959 app = \f, a => App f a
6060
6161 eFac : Expr G (TyFun TyInt TyInt)
62− eFac = Lam (If (Op (==) (Var fZ) (Val 0))
63− (Val 1) (Op (*) (app eFac (Op (-) (Var fZ) (Val 1))) (Var fZ)))
62+ eFac = Lam (If (Op (==) (Var FZ) (Val 0))
63+ (Val 1) (Op (*) (app eFac (Op (-) (Var FZ) (Val 1))) (Var FZ)))
6464
6565 -- Exercise elaborator: Complicated way of doing \x y => x*4 + y*2
6666
6767 eProg : Expr G (TyFun TyInt (TyFun TyInt TyInt))
68− eProg = Lam (Lam (Bind (App eDouble (Var (fS fZ)))
69− (\x => Bind (App eDouble (Var fZ))
68+ eProg = Lam (Lam (Bind (App eDouble (Var (FS FZ)))
69+ (\x => Bind (App eDouble (Var FZ))
7070 (\y => Bind (App eDouble (Val x))
7171 (\z => App (App eAdd (Val y)) (Val z))))))
7272
samples/interp.idr+2−2
@@ -14,8 +14,8 @@ using (G : Vect n Ty)
1414 (::) : interpTy a -> Env G -> Env (a :: G)
1515
1616 data HasType : (i : Fin n) -> Vect n Ty -> Ty -> Type where
17− stop : HasType fZ (t :: G) t
18− pop : HasType k G t -> HasType (fS k) (u :: G) t
17+ stop : HasType FZ (t :: G) t
18+ pop : HasType k G t -> HasType (FS k) (u :: G) t
1919
2020 lookup : HasType i G t -> Env G -> interpTy t
2121 lookup stop (x :: xs) = x
src/Idris/AbsSyntaxTree.hs+1−1
@@ -496,7 +496,7 @@ data FnOpt = Inlinable -- always evaluate when simplifying
496496 | CExport String -- export, with a C name
497497 | ErrorHandler -- ^^ an error handler for use with the ErrorReflection extension
498498 | ErrorReverse -- ^^ attempt to reverse normalise before showing in error
499− | Reflection -- a Reflecting function, compile-time only
499+ | Reflection -- a reflecting function, compile-time only
500500 | Specialise [(Name, Maybe Int)] -- specialise it, freeze these names
501501 | Constructor -- Data constructor type
502502 deriving (Show, Eq)
test/dsl001/test001.idr+3−3
@@ -14,8 +14,8 @@ using (G : Vect n Ty)
1414 (::) : interpTy a -> Env G -> Env (a :: G)
1515
1616 data HasType : (i : Fin n) -> Vect n Ty -> Ty -> Type where
17− stop : HasType fZ (t :: G) t
18− pop : HasType k G t -> HasType (fS k) (u :: G) t
17+ stop : HasType FZ (t :: G) t
18+ pop : HasType k G t -> HasType (FS k) (u :: G) t
1919
2020 lookup : HasType i G t -> Env G -> interpTy t
2121 lookup stop (x :: xs) = x
@@ -58,7 +58,7 @@ using (G : Vect n Ty)
5858 eAdd = expr (\x, y => Op (+) x y)
5959
6060-- eDouble : Expr G (TyFun TyInt TyInt)
61−-- eDouble = Lam (App (App (Lam (Lam (Op' (+) (Var fZ) (Var (fS fZ))))) (Var fZ)) (Var fZ))
61+-- eDouble = Lam (App (App (Lam (Lam (Op' (+) (Var FZ) (Var (FS FZ))))) (Var FZ)) (Var FZ))
6262
6363 eDouble : Expr G (TyFun TyInt TyInt)
6464 eDouble = expr (\x => App (App eAdd x) (Var stop))
test/dsl002/Resimp.idr+2−2
@@ -46,8 +46,8 @@ using (i: Fin n, gam : Vect n Ty, gam' : Vect n Ty, gam'' : Vect n Ty)
4646 interpTy (a :-> b) = a -> interpTy b
4747
4848 data HasType : Vect n Ty -> Fin n -> Ty -> Type where
49− stop : HasType (a :: gam) fZ a
50− pop : HasType gam i b -> HasType (a :: gam) (fS i) b
49+ stop : HasType (a :: gam) FZ a
50+ pop : HasType gam i b -> HasType (a :: gam) (FS i) b
5151
5252 data Env : Vect n Ty -> Type where
5353 Nil : Env Nil
test/dsl003/DSLPi.idr+3−3
@@ -25,14 +25,14 @@ using (vars : Vect n Ty)
2525dsl specs
2626 pi = ForAll
2727 variable = Var
28− index_first = fZ
29− index_next = fS
28+ index_first = FZ
29+ index_next = FS
3030
3131test2 : Spec []
3232test2 = specs ((x, y : INT) -> x === y)
3333
3434test3 : Spec []
35−test3 = ForAll INT . ForAll INT . ItHolds $ Var (fS fZ) === Var fZ
35+test3 = ForAll INT . ForAll INT . ItHolds $ Var (FS FZ) === Var FZ
3636
3737test4 : test2 = test3
3838test4 = Refl
test/dsl003/expected+1−1
@@ -1,2 +1,2 @@
1−ForAll INT (ForAll INT (ItHolds (Var (fS fZ) === Var fZ))) : Spec []
1+ForAll INT (ForAll INT (ItHolds (Var (FS FZ) === Var FZ))) : Spec []
22Refl : ARR BOOL (ARR INT UNIT) = ARR BOOL (ARR INT UNIT)
test/primitives003/test038.idr+4−4
@@ -52,10 +52,10 @@ main = do
5252 putStrLn . show $ test (Left "hello") (Right "world")
5353 putStrLn . show $ test (Left "hello") (Right False)
5454 -- Fin
55− putStrLn . show $ test (the (Fin (S (S (S (Z))))) (fS (fS (fZ))))
56− (the (Fin (S (S (S (Z))))) (fS (fS (fZ))))
57− putStrLn . show $ test (the (Fin (S (S (S (Z))))) (fS (fS (fZ))))
58− (the (Fin (S (S (S (Z))))) (fS (fZ)))
55+ putStrLn . show $ test (the (Fin (S (S (S (Z))))) (FS (FS (FZ))))
56+ (the (Fin (S (S (S (Z))))) (FS (FS (FZ))))
57+ putStrLn . show $ test (the (Fin (S (S (S (Z))))) (FS (FS (FZ))))
58+ (the (Fin (S (S (S (Z))))) (FS (FZ)))
5959 -- Nat
6060 putStrLn . show $ test (S (S (S Z))) (S (S (S Z)))
6161 putStrLn . show $ test (S (S (S Z))) (S (S Z))
test/quasiquote003/NoInfer.idr+2−2
@@ -4,7 +4,7 @@ import Language.Reflection
44import Language.Reflection.Utils
55
66zzz2 : TT
7−zzz2 = `(fZ : Fin 3)
7+zzz2 = `(FZ : Fin 3)
88
99zzz : TT
10−zzz = `(fZ)
10+zzz = `(FZ)
test/reg018/reg018d.idr+3−3
@@ -3,10 +3,10 @@ module Main
33total
44pull : Fin (S n) -> Vect (S n) a -> (a, Vect n a)
55pull {n=Z} _ (x :: xs) = (x, xs)
6−-- pull {n=S q} fZ (Vect.(::) {n=S _} x xs) = (x, xs)
7−pull {n=S _} (fS n) (x :: xs) =
6+-- pull {n=S q} FZ (Vect.(::) {n=S _} x xs) = (x, xs)
7+pull {n=S _} (FS n) (x :: xs) =
88 let (v, vs) = pull n xs in
99 (v, x::vs)
1010
1111main : IO ()
12−main = print (pull fZ [0, 1, 2])
12+main = print (pull FZ [0, 1, 2])
test/reg025/reg025.idr+5−5
@@ -21,18 +21,18 @@ Filled {n=n} = (\x => Not (Empty x))
2121FullBoard : Board n -> Type
2222FullBoard (MkBoard b) = All (All Filled) b
2323
24−indexStep : {i : Fin n} -> {xs : Vect n a} -> {x : a} -> index i xs = index (fS i) (x::xs)
24+indexStep : {i : Fin n} -> {xs : Vect n a} -> {x : a} -> index i xs = index (FS i) (x::xs)
2525indexStep = Refl
2626
2727find : {P : a -> Type} -> ((x : a) -> Dec (P x)) -> (xs : Vect n a)
2828 -> Either (All (\x => Not (P x)) xs) (y : a ** (P y, (i : Fin n ** y = index i xs)))
2929find _ Nil = Left Nil
3030find {P} d (x::xs) with (d x)
31− | Yes prf = Right (x ** (prf, (fZ ** Refl)))
31+ | Yes prf = Right (x ** (prf, (FZ ** Refl)))
3232 | No prf =
3333 case find {P} d xs of
3434 Right (y ** (prf', (i ** prf''))) =>
35− Right (y ** (prf', (fS i ** replace {P=(\x => y = x)} (indexStep {x=x}) prf'')))
35+ Right (y ** (prf', (FS i ** replace {P=(\x => y = x)} (indexStep {x=x}) prf'')))
3636 Left prf' => Left (prf::prf')
3737
3838empty : (cell : Cell n) -> Dec (Empty cell)
@@ -60,11 +60,11 @@ emptyCell (MkBoard rs) =
6060 helper Nil = Left Nil
6161 helper (r::rs) =
6262 case findEmptyInRow r of
63− Right (ci ** pf3) => Right (fZ ** (ci ** pf3))
63+ Right (ci ** pf3) => Right (FZ ** (ci ** pf3))
6464 Left prf =>
6565 case helper rs of
6666 Left prf' => Left (prf::prf')
67− Right (ri ** (ci ** pf4)) => Right (fS ri ** (ci ** pf4))
67+ Right (ri ** (ci ** pf4)) => Right (FS ri ** (ci ** pf4))
6868
6969
7070main : IO ()