summaryrefslogtreecommitdiff
path: root/src/Data/Connection/Optic/Int.hs
blob: eee7579351ab9c761ab5dce9f3cada72e4525d0c (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
module Data.Connection.Optic.Int (
  -- * Int8
    i08w08
  , i08w08'
  , i08i16
  , i08i32
  , i08i64
  -- * Int16
  , i16w16
  , i16w16'
  , i16i32
  , i16i64
  -- * Int32
  , i32w32
  , i32w32'
  , i32i64
  -- * Int64
  , i64w64
  , i64w64'
  -- * Integer
  , intnat
) where

import Data.Int
import Data.Word
import Data.Profunctor.Optic.Import
import Data.Profunctor.Optic.Grate
import Numeric.Natural
import qualified Data.Connection.Int as I

i08w08 :: Grate' Int8 Word8
i08w08 = connected I.i08w08

i08w08' :: Grate' Int8 Word8
i08w08' = connected I.i08w08'

-- >>> (127 :: Int8) + 3
-- -126
-- >>> zipWithOf i08i16 (+) 127 3
-- 127
i08i16 :: Grate' Int8 Int16
i08i16 = connected I.i08i16

i08i32 :: Grate' Int8 Int32
i08i32 = connected I.i08i32

i08i64 :: Grate' Int8 Int64
i08i64 = connected I.i08i64

i16w16 :: Grate' Int16 Word16
i16w16 = connected I.i16w16

i16w16' :: Grate' Int16 Word16
i16w16' = connected I.i16w16'

i16i32 :: Grate' Int16 Int32
i16i32 = connected I.i16i32

i16i64 :: Grate' Int16 Int64
i16i64 = connected I.i16i64

i32w32 :: Grate' Int32 Word32
i32w32 = connected I.i32w32

i32w32' :: Grate' Int32 Word32
i32w32' = connected I.i32w32'

i32i64 :: Grate' Int32 Int64
i32i64 = connected I.i32i64

i64w64 :: Grate' Int64 Word64
i64w64 = connected I.i64w64

i64w64' :: Grate' Int64 Word64
i64w64' = connected I.i64w64'

intnat :: Grate' Integer Natural
intnat = connected I.intnat