File tree Expand file tree Collapse file tree 5 files changed +98
-8
lines changed Expand file tree Collapse file tree 5 files changed +98
-8
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,9 @@ New modules
155
155
Data.Vec.Bounded.Base
156
156
Data.Vec.Bounded
157
157
158
+ Foreign.Haskell.Pair
159
+ Foreign.Haskell.Maybe
160
+
158
161
Relation.Binary.Construct.Closure.Reflexive.Properties
159
162
Relation.Binary.Construct.Closure.Reflexive.Properties.WithK
160
163
Relation.Binary.Construct.Closure.Equivalence.Properties
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ unsafeModules = map toAgdaFilePath
38
38
, " Data.Word.Unsafe"
39
39
, " Debug.Trace"
40
40
, " Foreign.Haskell"
41
+ , " Foreign.Haskell.Maybe"
42
+ , " Foreign.Haskell.Pair"
41
43
, " IO"
42
44
, " IO.Primitive"
43
45
, " Reflection"
Original file line number Diff line number Diff line change @@ -10,17 +10,23 @@ module Foreign.Haskell where
10
10
11
11
open import Level
12
12
13
- -- A pair type
13
+ ------------------------------------------------------------------------
14
+ -- Pairs
14
15
15
- record Pair {ℓ ℓ′ : Level} (A : Set ℓ) (B : Set ℓ′) : Set (ℓ ⊔ ℓ′) where
16
- constructor _,_
17
- field fst : A
18
- snd : B
19
- open Pair public
16
+ open import Foreign.Haskell. Pair public
17
+ renaming
18
+ ( toForeign to toForeignPair
19
+ ; fromForeign to fromForeignPair
20
+ )
20
21
21
- {-# FOREIGN GHC type AgdaPair l1 l2 a b = (a , b) #-}
22
- {-# COMPILE GHC Pair = data MAlonzo.Code.Foreign.Haskell.AgdaPair ((,)) #-}
22
+ ------------------------------------------------------------------------
23
+ -- Maybe
23
24
25
+ open import Foreign.Haskell.Maybe public
26
+ renaming
27
+ ( toForeign to toForeignMaybe
28
+ ; fromForeign to fromForeignMaybe
29
+ )
24
30
25
31
------------------------------------------------------------------------
26
32
-- DEPRECATED NAMES
Original file line number Diff line number Diff line change
1
+ ------------------------------------------------------------------------
2
+ -- The Agda standard library
3
+ --
4
+ -- Which Maybe type which calls out to Haskell via the FFI
5
+ ------------------------------------------------------------------------
6
+
7
+ {-# OPTIONS --without-K #-}
8
+
9
+ module Foreign.Haskell.Maybe where
10
+
11
+ open import Level
12
+ import Data.Maybe as Data
13
+
14
+ private
15
+ variable
16
+ a : Level
17
+ A : Set a
18
+
19
+ ------------------------------------------------------------------------
20
+ -- Definition
21
+
22
+ abstract
23
+
24
+ Maybe : Set a → Set a
25
+ Maybe = Data.Maybe
26
+
27
+ {-# FOREIGN GHC type AgdaMaybe l a = Maybe a #-}
28
+ {-# COMPILE GHC Maybe = data AgdaMaybe (Just | Nothing) #-}
29
+
30
+ ------------------------------------------------------------------------
31
+ -- Conversion
32
+
33
+ abstract
34
+
35
+ toForeign : Data.Maybe A → Maybe A
36
+ toForeign x = x
37
+
38
+ fromForeign : Maybe A → Data.Maybe A
39
+ fromForeign x = x
Original file line number Diff line number Diff line change
1
+ ------------------------------------------------------------------------
2
+ -- The Agda standard library
3
+ --
4
+ -- The Pair type which calls out to Haskell via the FFI
5
+ ------------------------------------------------------------------------
6
+
7
+ {-# OPTIONS --without-K #-}
8
+
9
+ module Foreign.Haskell.Pair where
10
+
11
+ open import Level
12
+ open import Data.Product using (_×_; _,_)
13
+
14
+ private
15
+ variable
16
+ a b : Level
17
+ A : Set a
18
+ B : Set b
19
+
20
+ ------------------------------------------------------------------------
21
+ -- Definition
22
+
23
+ abstract
24
+
25
+ Pair : Set a → Set b → Set (a ⊔ b)
26
+ Pair = _×_
27
+
28
+ {-# FOREIGN GHC type AgdaPair l1 l2 a b = (a , b) #-}
29
+ {-# COMPILE GHC Pair = data MAlonzo.Code.Foreign.Haskell.AgdaPair ((,)) #-}
30
+
31
+ ------------------------------------------------------------------------
32
+ -- Conversion
33
+
34
+ abstract
35
+
36
+ toForeign : A × B → Pair A B
37
+ toForeign x = x
38
+
39
+ fromForeign : Pair A B → A × B
40
+ fromForeign x = x
You can’t perform that action at this time.
0 commit comments