File tree 5 files changed +83
-0
lines changed
5 files changed +83
-0
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,13 @@ New modules
177
177
Data.Vec.Bounded.Show
178
178
```
179
179
180
+ * A type of bytes:
181
+ ``` agda
182
+ Data.Word8.Primitive
183
+ Data.Word8.Base
184
+ Data.Word8.Literals
185
+ ```
186
+
180
187
Additions to existing modules
181
188
-----------------------------
182
189
Original file line number Diff line number Diff line change @@ -161,6 +161,9 @@ sizedTypesModules = map modToFile
161
161
, " Codata.Sized.Thunk"
162
162
, " Data.Container.Fixpoints.Sized"
163
163
, " Data.W.Sized"
164
+ , " Data.Word8.Base"
165
+ , " Data.Word8.Literals"
166
+ , " Data.Word8.Primitive"
164
167
, " Data.Nat.PseudoRandom.LCG.Unsafe"
165
168
, " Data.Tree.Binary.Show"
166
169
, " Data.Tree.Rose"
Original file line number Diff line number Diff line change
1
+ ------------------------------------------------------------------------
2
+ -- The Agda standard library
3
+ --
4
+ -- Bytes: base type and functions
5
+ ------------------------------------------------------------------------
6
+
7
+ {-# OPTIONS --cubical-compatible #-}
8
+
9
+ module Data.Word8.Base where
10
+
11
+ open import Agda.Builtin.Bool using (Bool)
12
+ open import Agda.Builtin.Nat using (Nat; _==_)
13
+ open import Agda.Builtin.String using (String)
14
+ open import Agda.Builtin.Unit using (⊤)
15
+
16
+ ------------------------------------------------------------------------------
17
+ -- Re-export type and operations
18
+
19
+ open import Data.Word8.Primitive as Prim public
20
+ using ( Word8
21
+ ; _+_)
22
+ renaming ( fromNat to fromℕ
23
+ ; toNat to toℕ
24
+ )
25
+
26
+ ------------------------------------------------------------------------------
27
+ -- Basic functions
28
+
29
+ _≡ᵇ_ : Word8 → Word8 → Bool
30
+ w ≡ᵇ w′ = toℕ w == toℕ w′
Original file line number Diff line number Diff line change
1
+ ------------------------------------------------------------------------
2
+ -- The Agda standard library
3
+ --
4
+ -- Byte Literals
5
+ ------------------------------------------------------------------------
6
+
7
+ {-# OPTIONS --cubical-compatible #-}
8
+
9
+ module Data.Word8.Literals where
10
+
11
+ open import Agda.Builtin.FromNat using (Number)
12
+ open import Data.Unit.Base using (⊤)
13
+ open import Data.Word8.Base using (Word8; fromℕ)
14
+
15
+ number : Number Word8
16
+ number = record
17
+ { Constraint = λ _ → ⊤
18
+ ; fromNat = λ w → fromℕ w
19
+ }
Original file line number Diff line number Diff line change
1
+ ------------------------------------------------------------------------
2
+ -- The Agda standard library
3
+ --
4
+ -- Bytes: simple bindings to Haskell types and functions
5
+ ------------------------------------------------------------------------
6
+
7
+ {-# OPTIONS --cubical-compatible #-}
8
+
9
+ module Data.Word8.Primitive where
10
+
11
+ open import Agda.Builtin.Nat using (Nat)
12
+
13
+ postulate
14
+ Word8 : Set
15
+ fromNat : Nat → Word8
16
+ toNat : Word8 → Nat
17
+ _+_ : Word8 → Word8 → Word8
18
+
19
+ {-# FOREIGN GHC import GHC.Word #-}
20
+
21
+ {-# COMPILE GHC Word8 = type Word8 #-}
22
+ {-# COMPILE GHC fromNat = fromIntegral #-}
23
+ {-# COMPILE GHC toNat = fromIntegral #-}
24
+ {-# COMPILE GHC _+_ = (+) #-}
You can’t perform that action at this time.
0 commit comments