Debian Codegraph @

src/Foreign/Haskell/Maybe.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- This module is DEPRECATED. Please use the builtin Maybe instead.
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible #-}
8
9 module Foreign.Haskell.Maybe where
10
11 open import Level using (Level; _⊔_)
12 open import Data.Maybe.Base as Data using (just; nothing)
13
14 private
15 variable
16 a : Level
17 A : Set a
18
19 ------------------------------------------------------------------------
20 -- Definition
21
22 data Maybe (A : Set a) : Set a where
23 just : A → Maybe A
24 nothing : Maybe A
25
26 {-# FOREIGN GHC type AgdaMaybe l a = Maybe a #-}
27 {-# COMPILE GHC Maybe = data AgdaMaybe (Just | Nothing) #-}
28
29 ------------------------------------------------------------------------
30 -- Conversion
31
32 toForeign : Data.Maybe A → Maybe A
33 toForeign (just x) = just x
34 toForeign nothing = nothing
35
36 fromForeign : Maybe A → Data.Maybe A
37 fromForeign (just x) = just x
38 fromForeign nothing = nothing
39
40
41 {-# WARNING_ON_IMPORT
42 "Warning: Foreign.Haskell.Maybe was deprecated in v1.4.
43 Maybe is now an Agda builtin and does not need library support."
44 #-}
45
46 {-# WARNING_ON_USAGE Maybe
47 "Warning: Foreign.Haskell.Maybe's Maybe was deprecated in v1.4.
48 Maybe is now an Agda builtin and does not need library support."
49 #-}
50
51 {-# WARNING_ON_USAGE toForeign
52 "Warning: toForeign was deprecated in v1.4.
53 Maybe is now an Agda builtin and does not need library support."
54 #-}
55
56 {-# WARNING_ON_USAGE fromForeign
57 "Warning: fromForeign was deprecated in v1.4.
58 Maybe is now an Agda builtin and does not need library support."
59 #-}