@@ -28,23 +28,20 @@ instance (Q.Arbitrary a) => Q.Arbitrary (OneParamType a) where
2828 ]
2929 shrink = Q. genericShrink
3030
31- type OPTFn a r = (a -> r ) -> (Maybe a -> r ) -> (a -> a -> r ) -> OneParamType a -> r
31+ type OPTFn a r = OneParamType a -> (a -> r ) -> (Maybe a -> r ) -> (a -> a -> r ) -> r
3232
33- type FunArgs a r = '[Fun a r , Fun (Maybe a ) r , Fun a (Fun a r ), OneParamType a ]
33+ type FunArgs a r = '[OneParamType a , Fun a r , Fun (Maybe a ) r , Fun a (Fun a r )]
3434
3535type OPTFun a r = Chain (FunArgs a r ) r
3636
3737manual :: OPTFn a r
38- manual fromA fromM fromAs = \ case
38+ manual opt fromA fromM fromAs = case opt of
3939 OPT1 a -> fromA a
4040 OPT2 m -> fromM m
4141 OPT3 a1 a2 -> fromAs a1 a2
4242
43- optR :: forall a r . OPTFn a r
44- optR = gcaseR @ (OneParamType a )
45-
46- optL :: forall a r . OneParamType a -> (a -> r ) -> (Maybe a -> r ) -> (a -> a -> r ) -> r
47- optL = gcaseL @ (OneParamType a )
43+ gopt :: forall a r . OPTFn a r
44+ gopt = gcase @ (OneParamType a )
4845
4946specOPT ::
5047 forall a r .
@@ -65,24 +62,18 @@ specOPT name f =
6562 (name, mkFn f)
6663
6764mkFn ::
65+ forall a r .
6866 OPTFn a r ->
6967 OPTFun a r
70- mkFn f f1 f2 f3 = f (applyFun f1) (applyFun f2) (applyFun <$> applyFun f3)
71-
72- optL_ :: OPTFn a r
73- optL_ r fromInt fromStringChar opt = optL opt r fromInt fromStringChar
68+ mkFn f m f1 f2 f3 = f m (applyFun f1) (applyFun f2) (applyFun <$> applyFun f3)
7469
7570spec :: H. Spec
7671spec = do
7772 H. describe " OneParamType () -> Char" $ do
78- specOPT @ () @ Char " optR" optR
79- specOPT @ () @ Char " optL" optL_
73+ specOPT @ () @ Char " gopt" gopt
8074 H. describe " OneParamType Char -> Either String ()" $ do
81- specOPT @ Char @ (Either String () ) " optR" optR
82- specOPT @ Char @ (Either String () ) " optL" optL_
75+ specOPT @ Char @ (Either String () ) " gopt" gopt
8376 H. describe " OneParamType String -> (Int, Either Integer Int)" $ do
84- specOPT @ String @ (Int , Either Integer Int ) " optR" optR
85- specOPT @ String @ (Int , Either Integer Int ) " optL" optL_
77+ specOPT @ String @ (Int , Either Integer Int ) " gopt" gopt
8678 H. describe " OneParamType [Maybe (Int, String)] -> (Int, [Either (Maybe ()) String])" $ do
87- specOPT @ [Maybe (Int , String )] @ (Int , [Either (Maybe () ) String ]) " optR" optR
88- specOPT @ [Maybe (Int , String )] @ (Int , [Either (Maybe () ) String ]) " optL" optL_
79+ specOPT @ [Maybe (Int , String )] @ (Int , [Either (Maybe () ) String ]) " gopt" gopt
0 commit comments