Prelude/Maybe.ad

Outline

Content

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
module Prelude.Maybe (
  Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable(..)case-constant `caseMaybe`
constructor `Nothing`
constructor `Just`
,
  isJustconstant `Prelude.Maybe.isJust`
   constant
   type `Maybe 'a -> Bool`
   executable,
  isNothingconstant `Prelude.Maybe.isNothing`
   constant
   type `Maybe 'a -> Bool`
   executable,
  fromMaybeconstant `Prelude.Maybe.fromMaybe`
   constant
   type `'a -> Maybe 'a -> 'a`
   executable,
  mapconstant `Prelude.Maybe.map`
   constant
   type `('a -> 'b) -> Maybe 'a -> Maybe 'b`
   executable,
  fromMaybeMapconstant `Prelude.Maybe.fromMaybeMap`
   constant
   type `'b -> ('a -> 'b) -> Maybe 'a -> 'b`
   executable,
  bindconstant `Prelude.Maybe.bind`
   constant
   type `Maybe 'a -> ('a -> Maybe 'b) -> Maybe 'b`
   executable
) where

{-# NoImplicitPrelude #-}

import Prelude.Bool
import Prelude.Eq
import Prelude.Ord
import Prelude.Default
import Prelude.Template
import Prelude.Functor

datatype Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'atype-variable `'a`
   kind `*` :=
    Nothing
  | Just 'atype-variable `'a`
   kind `*`

instance Defaulttype-class `Prelude.Default.Default`
   arguments: ('a :: *)
   has default derive templates (Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'atype-variable `'a`
   kind `*`) where
  define defaultconstant `Prelude.Default.default`
   constant of type-class instance `Default (Maybe 'a)`
   type `Maybe 'a`
   executable := Nothingconstant `Prelude.Maybe.Nothing`
   constructor of datatype `Maybe`
   type `Maybe 'a`
   executable
end-instance

declare mapconstant `Prelude.Maybe.map`
   constant
   type `('a -> 'b) -> Maybe 'a -> Maybe 'b`
   executable :: ('atype-variable `'a`
   kind `*` -> 'btype-variable `'b`
   kind `*`) -> Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'atype-variable `'a`
   kind `*` -> Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'btype-variable `'b`
   kind `*`
define mapconstant `Prelude.Maybe.map`
   constant
   type `('a -> 'b) -> Maybe 'a -> Maybe 'b`
   executable _ Nothingconstant `Prelude.Maybe.Nothing`
   constructor of datatype `Maybe`
   type `Maybe 'a`
   executable := Nothingconstant `Prelude.Maybe.Nothing`
   constructor of datatype `Maybe`
   type `Maybe 'a`
   type in context `Maybe 'b`
   executable
     | mapconstant `Prelude.Maybe.map`
   constant
   type `('a -> 'b) -> Maybe 'a -> Maybe 'b`
   executable fvariable `f`
   type `'a -> 'b` (Justconstant `Prelude.Maybe.Just`
   constructor of datatype `Maybe`
   type `'a -> Maybe 'a`
   executable xvariable `x`
   type `'a`) := Justconstant `Prelude.Maybe.Just`
   constructor of datatype `Maybe`
   type `'a -> Maybe 'a`
   type in context `'b -> Maybe 'b`
   executable (fvariable `f`
   type `'a -> 'b` xvariable `x`
   type `'a`)

instance Functortype-class `Prelude.Functor.Functor`
   arguments: ('F :: * -> *)
   reserved var-names: 'a, 'b
   statically-resolved Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable where
  define fmapconstant `Prelude.Functor.fmap`
   constant of type-class instance `Functor Maybe`
   type `('a -> 'b) -> Maybe 'a -> Maybe 'b`
   executable := mapconstant `Prelude.Maybe.map`
   constant
   type `('a -> 'b) -> Maybe 'a -> Maybe 'b`
   executable
  {-# inline fmapconstant `Prelude.Functor.fmap`
   constant of type-class instance `Functor Maybe`
   type `('a -> 'b) -> Maybe 'a -> Maybe 'b`
   executable #-}
end-instance

declare bindconstant `Prelude.Maybe.bind`
   constant
   type `Maybe 'a -> ('a -> Maybe 'b) -> Maybe 'b`
   executable :: Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'atype-variable `'a`
   kind `*` -> ('atype-variable `'a`
   kind `*` -> Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'btype-variable `'b`
   kind `*`) -> Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'btype-variable `'b`
   kind `*`
define bindconstant `Prelude.Maybe.bind`
   constant
   type `Maybe 'a -> ('a -> Maybe 'b) -> Maybe 'b`
   executable Nothingconstant `Prelude.Maybe.Nothing`
   constructor of datatype `Maybe`
   type `Maybe 'a`
   executable _ := Nothingconstant `Prelude.Maybe.Nothing`
   constructor of datatype `Maybe`
   type `Maybe 'a`
   type in context `Maybe 'b`
   executable
     | bindconstant `Prelude.Maybe.bind`
   constant
   type `Maybe 'a -> ('a -> Maybe 'b) -> Maybe 'b`
   executable (Justconstant `Prelude.Maybe.Just`
   constructor of datatype `Maybe`
   type `'a -> Maybe 'a`
   executable xvariable `x`
   type `'a`) fvariable `f`
   type `'a -> Maybe 'b` := fvariable `f`
   type `'a -> Maybe 'b` xvariable `x`
   type `'a`

declare fromMaybeconstant `Prelude.Maybe.fromMaybe`
   constant
   type `'a -> Maybe 'a -> 'a`
   executable :: 'atype-variable `'a`
   kind `*` -> Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'atype-variable `'a`
   kind `*` -> 'atype-variable `'a`
   kind `*`
define fromMaybeconstant `Prelude.Maybe.fromMaybe`
   constant
   type `'a -> Maybe 'a -> 'a`
   executable dvariable `d`
   type `'a` Nothingconstant `Prelude.Maybe.Nothing`
   constructor of datatype `Maybe`
   type `Maybe 'a`
   executable := dvariable `d`
   type `'a`
     | fromMaybeconstant `Prelude.Maybe.fromMaybe`
   constant
   type `'a -> Maybe 'a -> 'a`
   executable _dvariable `_d`
   type `'a` (Justconstant `Prelude.Maybe.Just`
   constructor of datatype `Maybe`
   type `'a -> Maybe 'a`
   executable vvariable `v`
   type `'a`) := vvariable `v`
   type `'a`

declare fromMaybeMapconstant `Prelude.Maybe.fromMaybeMap`
   constant
   type `'b -> ('a -> 'b) -> Maybe 'a -> 'b`
   executable :: 'btype-variable `'b`
   kind `*` -> ('atype-variable `'a`
   kind `*` -> 'btype-variable `'b`
   kind `*`) -> Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'atype-variable `'a`
   kind `*` -> 'btype-variable `'b`
   kind `*`
define fromMaybeMapconstant `Prelude.Maybe.fromMaybeMap`
   constant
   type `'b -> ('a -> 'b) -> Maybe 'a -> 'b`
   executable dvariable `d`
   type `'b` fvariable `f`
   type `'a -> 'b` mvariable `m`
   type `Maybe 'a` := fromMaybeconstant `Prelude.Maybe.fromMaybe`
   constant
   type `'a -> Maybe 'a -> 'a`
   type in context `'b -> Maybe 'b -> 'b`
   executable dvariable `d`
   type `'b` (mapconstant `Prelude.Maybe.map`
   constant
   type `('a -> 'b) -> Maybe 'a -> Maybe 'b`
   executable fvariable `f`
   type `'a -> 'b` mvariable `m`
   type `Maybe 'a`)

generate-codegenerated code:

declare isNothing :: Maybe 'a -> Bool
define isNothing Nothing := True
     | isNothing _ := False

declare isJust :: Maybe 'a -> Bool
define isJust (Just _) := True
     | isJust _ := False

 GenerateRecogniserstemplate `Prelude.Template.GenerateRecognisers`
   argument-type: TypeID
   return-type: -(type Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable)

derive Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable instances (EqPtype-class `Prelude.Eq.EqP`
   arguments: ('a :: *)
   has default derive templates
   derive-template labels
     - eq (only deriving)
     - full
generated code: instance EqP 'a => EqP (Maybe 'a) where define non-exec (===) Nothing Nothing := true | (===) (Just x1) (Just y1) := (x1 === y1) | (===) _ _ := false end-instance
, Eqtype-class `Prelude.Eq.Eq` arguments: ('a :: *) super-class constraints: - Prelude.Eq.EqP 'a has default derive templates
generated code: instance Eq 'a => Eq (Maybe 'a) where define (==) Nothing Nothing := True | (==) (Just x1) (Just y1) := (x1 == y1) | (==) _ _ := False end-instance
, Ordtype-class `Prelude.Ord.Ord` arguments: ('a :: *) super-class constraints: - Prelude.Eq.Eq 'a has default derive templates
generated code: instance Ord 'a => Ord (Maybe 'a) where define compare Nothing Nothing := EQ | compare Nothing _ := LT | compare _ Nothing := GT | compare (Just x1) (Just y1) := compare x1 y1 end-instance
)
end-moduleend of module Prelude.Maybe