on develop help sign in
Fix warnings
eb9d786Ali Abrar
src/Generics/SOP/DMapUtilities.hs+9−9
@@ -96,7 +96,7 @@ nsToDSum = hcollapse . ap_NS (hmap (\tag -> (fn $ \val -> K (tag :=> val))) make
96-}
96-}
97
97
98-- |Convert a 'DS.DSum' indexed by 'TypeListTag' xs into a 'NS' indexed by xs
98-- |Convert a 'DS.DSum' indexed by 'TypeListTag' xs into a 'NS' indexed by xs
99−dSumToNS :: SListI xs => DS.DSum (TypeListTag xs) f -> NS f xs
99+dSumToNS :: DS.DSum (TypeListTag xs) f -> NS f xs
100dSumToNS (tag :=> fa) = go tag fa
100dSumToNS (tag :=> fa) = go tag fa
101 where
101 where
102 go::TypeListTag ys y -> f y -> NS f ys
102 go::TypeListTag ys y -> f y -> NS f ys
@@ -107,7 +107,7 @@ dSumToNS (tag :=> fa) = go tag fa
107makeTypeListTagNP :: SListI xs => NP (TypeListTag xs) xs
107makeTypeListTagNP :: SListI xs => NP (TypeListTag xs) xs
108makeTypeListTagNP = go sList
108makeTypeListTagNP = go sList
109 where
109 where
110− go :: forall ys. SListI ys => SList ys -> NP (TypeListTag ys) ys
110+ go :: SList ys -> NP (TypeListTag ys) ys
111 go SNil = Nil
111 go SNil = Nil
112 go SCons = TLHead :* hmap TLTail (go sList)
112 go SCons = TLHead :* hmap TLTail (go sList)
113
113
@@ -124,7 +124,7 @@ type family FunctorWrapTypeListOfLists (f :: * -> *) (xss :: [[*]]) :: [[*]] whe
124-- composition has been moved to the type-list. The values in the product remain the same (up to types representing composition of the functors). E.g.,
124-- composition has been moved to the type-list. The values in the product remain the same (up to types representing composition of the functors). E.g.,
125--
125--
126-- > (f :.: g) 2 :* (f :.: g) 3.0 :* 'Nil :: NP (f :.: g) '[Int,Double] -> f (g 2) :* f (g 3.0) :* 'Nil :: NP f '[g Int, g Double]
126-- > (f :.: g) 2 :* (f :.: g) 3.0 :* 'Nil :: NP (f :.: g) '[Int,Double] -> f (g 2) :* f (g 3.0) :* 'Nil :: NP f '[g Int, g Double]
127−npUnCompose :: forall f g xs. SListI xs => NP (f :.: g) xs -> NP f (FunctorWrapTypeList g xs)
127+npUnCompose :: forall f g xs. NP (f :.: g) xs -> NP f (FunctorWrapTypeList g xs)
128npUnCompose = go
128npUnCompose = go
129 where
129 where
130 go :: NP (f :.: g) ys -> NP f (FunctorWrapTypeList g ys)
130 go :: NP (f :.: g) ys -> NP f (FunctorWrapTypeList g ys)
@@ -132,9 +132,9 @@ npUnCompose = go
132 go (fgx :* npTail) = unComp fgx :* go npTail
132 go (fgx :* npTail) = unComp fgx :* go npTail
133
133
134-- | UnCompose all of the 'NP's in an "NS (NP f) xss".
134-- | UnCompose all of the 'NP's in an "NS (NP f) xss".
135−nsOfnpUnCompose :: forall f g xss. (SListI xss, SListI2 xss) => NS (NP (f :.: g)) xss -> NS (NP f) (FunctorWrapTypeListOfLists g xss)
135+nsOfnpUnCompose :: forall f g xss. (SListI2 xss) => NS (NP (f :.: g)) xss -> NS (NP f) (FunctorWrapTypeListOfLists g xss)
136nsOfnpUnCompose = go sList where
136nsOfnpUnCompose = go sList where
137− go :: forall yss. (SListI yss, SListI2 yss) => SList yss -> NS (NP (f :.: g)) yss -> NS (NP f) (FunctorWrapTypeListOfLists g yss)
137+ go :: forall yss. (SListI2 yss) => SList yss -> NS (NP (f :.: g)) yss -> NS (NP f) (FunctorWrapTypeListOfLists g yss)
138 go SNil _ = error "An NS cannot be empty"
138 go SNil _ = error "An NS cannot be empty"
139 go SCons (Z np) = Z (npUnCompose np)
139 go SCons (Z np) = Z (npUnCompose np)
140 go SCons (S ns') = S (go sList ns')
140 go SCons (S ns') = S (go sList ns')
@@ -145,15 +145,15 @@ nsOfnpUnCompose = go sList where
145npReCompose :: forall f g xs. SListI xs => NP f (FunctorWrapTypeList g xs) -> NP (f :.: g) xs
145npReCompose :: forall f g xs. SListI xs => NP f (FunctorWrapTypeList g xs) -> NP (f :.: g) xs
146npReCompose = go sList
146npReCompose = go sList
147 where
147 where
148− go :: forall ys. SListI ys => SList ys -> NP f (FunctorWrapTypeList g ys) -> NP (f :.: g) ys
148+ go :: forall ys. SList ys -> NP f (FunctorWrapTypeList g ys) -> NP (f :.: g) ys
149 go SNil Nil = Nil
149 go SNil Nil = Nil
150 go SCons (fgx :* npTail) = Comp fgx :* go sList npTail
150 go SCons (fgx :* npTail) = Comp fgx :* go sList npTail
151
151
152-- | ReCompose all the 'NP's in an "NS (NP f) xss".
152-- | ReCompose all the 'NP's in an "NS (NP f) xss".
153−nsOfnpReCompose :: forall f g xss. (SListI xss, SListI2 xss) => NS (NP f) (FunctorWrapTypeListOfLists g xss) -> NS (NP (f :.: g)) xss
153+nsOfnpReCompose :: forall f g xss. (SListI2 xss) => NS (NP f) (FunctorWrapTypeListOfLists g xss) -> NS (NP (f :.: g)) xss
154nsOfnpReCompose = go sList
154nsOfnpReCompose = go sList
155 where
155 where
156− go :: forall yss. (SListI2 yss, SListI yss) => SList yss -> NS (NP f) (FunctorWrapTypeListOfLists g yss) -> NS (NP (f :.: g)) yss
156+ go :: forall yss. (SListI2 yss) => SList yss -> NS (NP f) (FunctorWrapTypeListOfLists g yss) -> NS (NP (f :.: g)) yss
157 go SNil _ = error "NS must be non-empty." -- this shouldn't happen since an NS can't be empty
157 go SNil _ = error "NS must be non-empty." -- this shouldn't happen since an NS can't be empty
158 go SCons (Z np) = Z $ npReCompose np
158 go SCons (Z np) = Z $ npReCompose np
159 go SCons (S nsTail) = S $ go sList nsTail
159 go SCons (S nsTail) = S $ go sList nsTail
@@ -173,7 +173,7 @@ functorWrappedSListIsSList pf SCons = goCons (sList :: SList xs)
173-- This is useful in cases where an efficient general solution exists for DMaps.
173-- This is useful in cases where an efficient general solution exists for DMaps.
174-- This can be done more simply for Applicative f but the efficiency will depend on
174-- This can be done more simply for Applicative f but the efficiency will depend on
175-- the particular functor and given function over 'DM.DMap'.
175-- the particular functor and given function over 'DM.DMap'.
176−npSequenceViaDMap :: forall k (f :: * -> *) (g :: * -> *) (xs :: [*]). (Functor f, SListI xs, DM.GCompare k
176+npSequenceViaDMap :: forall k (f :: * -> *) (g :: * -> *) (xs :: [*]). (Functor f, SListI xs
177 , k ~ TypeListTag (FunctorWrapTypeList g xs))
177 , k ~ TypeListTag (FunctorWrapTypeList g xs))
178 =>(DM.DMap k f -> f (DM.DMap k Identity))->NP (f :.: g) xs -> f (NP g xs)
178 =>(DM.DMap k f -> f (DM.DMap k Identity))->NP (f :.: g) xs -> f (NP g xs)
179npSequenceViaDMap sequenceDMap =
179npSequenceViaDMap sequenceDMap =
src/Generics/SOP/Distribute.hs+4−5
@@ -34,7 +34,7 @@ import Generics.SOP.Dict (Dict, withDict)
34-- | Turn a sum into a product with Maybes
34-- | Turn a sum into a product with Maybes
35expand :: forall (f :: [k] -> *) xs. (SListI xs) => NS f xs -> NP (Maybe :.: f) xs
35expand :: forall (f :: [k] -> *) xs. (SListI xs) => NS f xs -> NP (Maybe :.: f) xs
36expand ns = go sList (Just ns) where
36expand ns = go sList (Just ns) where
37− go :: forall ys.SListI ys => SList ys -> Maybe (NS f ys) -> NP (Maybe :.: f) ys
37+ go :: forall ys. SList ys -> Maybe (NS f ys) -> NP (Maybe :.: f) ys
38 go SNil _ = Nil
38 go SNil _ = Nil
39 go SCons mNS = case mNS of
39 go SCons mNS = case mNS of
40 Nothing -> Comp Nothing :* go sList Nothing -- after Z
40 Nothing -> Comp Nothing :* go sList Nothing -- after Z
@@ -103,8 +103,9 @@ reconstructA :: (Functor h, Generic a) => NP (h :.: NP I) (Code a) -> NP (K (h a
103reconstructA = hliftA (K . fmap (to . SOP) . unK) . hap wrappedInjections
103reconstructA = hliftA (K . fmap (to . SOP) . unK) . hap wrappedInjections
104
104
105-- | Utility for turning a constraint into a POP (an NP of NP) of natural transformations at a given type.
105-- | Utility for turning a constraint into a POP (an NP of NP) of natural transformations at a given type.
106−functionPOPFromClass :: forall c f g xss. SListI2 xss
106+functionPOPFromClass
107+ :: forall c f g xss
107− => Dict (All2 c) xss
108+ . Dict (All2 c) xss
108 -> (forall a. c a => f a -> g a)
109 -> (forall a. c a => f a -> g a)
109 -> POP (f -.-> g) xss
110 -> POP (f -.-> g) xss
110functionPOPFromClass d f = withDict d $ hcpure (Proxy :: Proxy c) $ Fn f
111functionPOPFromClass d f = withDict d $ hcpure (Proxy :: Proxy c) $ Fn f
@@ -116,5 +117,3 @@ functionPOPFromClass' fn =
116 dict = all_POP hdicts
117 dict = all_POP hdicts
117 in withDict dict $ hcpure (Proxy :: Proxy c) $ Fn fn
118 in withDict dict $ hcpure (Proxy :: Proxy c) $ Fn fn
118-}
119-}
119−
120−