File tree Expand file tree Collapse file tree 4 files changed +15
-12
lines changed Expand file tree Collapse file tree 4 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ import Functora.Prelude
47
47
import Functora.Tags as X
48
48
import qualified Language.Haskell.TH.Syntax as TH
49
49
50
- type IntRep tags = NewIntRep (GetKey SignedOrUnsigned tags )
50
+ type IntRep tags = NewIntRep (GetTag SignedOrUnsigned tags )
51
51
52
52
type family NewIntRep sig where
53
53
NewIntRep 'Signed = Integer
@@ -297,7 +297,7 @@ unJsonRational = toRational <$> A.scientific
297
297
unJsonMoney ::
298
298
forall tags (sig :: SignedOrUnsigned ).
299
299
( MoneyTags tags ,
300
- GetTag sig tags
300
+ HasTag sig tags
301
301
) =>
302
302
A. Decoder (Money tags )
303
303
unJsonMoney = do
Original file line number Diff line number Diff line change @@ -76,13 +76,13 @@ deriving via
76
76
Rational
77
77
instance
78
78
( MoneyTags tags ,
79
- GetTag (sig :: SignedOrUnsigned ) tags
79
+ HasTag (sig :: SignedOrUnsigned ) tags
80
80
) =>
81
81
PersistFieldSql (Money tags )
82
82
83
83
instance
84
84
( MoneyTags tags ,
85
- GetTag (sig :: SignedOrUnsigned ) tags
85
+ HasTag (sig :: SignedOrUnsigned ) tags
86
86
) =>
87
87
PersistField (Money tags )
88
88
where
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ module Functora.TagsFamily
13
13
-- * Accessors
14
14
-- $accessors
15
15
GetTag ,
16
- GetKey ,
16
+ HasTag ,
17
17
18
18
-- * Fingerprints
19
19
-- $fingerprints
@@ -69,12 +69,15 @@ type family lhs |&| rhs where
69
69
-- $accessors
70
70
-- Accessors
71
71
72
- type GetTag (v :: k ) tags =
73
- ( v ~ GetTagFamily ('Nothing :: Maybe k ) k tags tags ,
74
- SingI v
75
- )
72
+ type GetTag k tags = GetTagFamily ('Nothing :: Maybe k ) k tags tags
76
73
77
- type GetKey k tags = GetTagFamily ('Nothing :: Maybe k ) k tags tags
74
+ type HasTag (v :: k ) tags =
75
+ ( SingI v ,
76
+ Typeable v ,
77
+ Typeable k ,
78
+ Typeable tags ,
79
+ v ~ GetTag k tags
80
+ )
78
81
79
82
-- $fingerprints
80
83
-- Fingerprints
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ newMoney = Tagged $ 4 % 5
14
14
15
15
getSymbolTag ::
16
16
forall (tag :: Symbol ) tags rep .
17
- ( GetTag tag tags
17
+ ( HasTag tag tags
18
18
) =>
19
19
Tagged tags rep ->
20
20
Demote Symbol
@@ -23,7 +23,7 @@ getSymbolTag _ =
23
23
24
24
getGainOrLoseTag ::
25
25
forall (tag :: GainOrLose ) tags rep .
26
- ( GetTag tag tags
26
+ ( HasTag tag tags
27
27
) =>
28
28
Tagged tags rep ->
29
29
GainOrLose
You can’t perform that action at this time.
0 commit comments