Fixed the GenClassPerType option to actually generate the forwarding instance from PolyplateM to the type-specific class
This commit is contained in:
parent
360b076be9
commit
c83c383181
|
@ -283,9 +283,7 @@ instancesFrom genOverlapped genClass boxes w
|
||||||
contextNewType :: String -> String -> String -> String
|
contextNewType :: String -> String -> String -> String
|
||||||
contextNewType cName ops0 ops1 = case genClass of
|
contextNewType cName ops0 ops1 = case genClass of
|
||||||
GenOneClass -> "PolyplateM (" ++ cName ++ ") " ++ ops0 ++ " " ++ ops1 ++ " m"
|
GenOneClass -> "PolyplateM (" ++ cName ++ ") " ++ ops0 ++ " " ++ ops1 ++ " m"
|
||||||
GenClassPerType -> "PolyplateM" ++ cMunged ++ " " ++ ops0 ++ " " ++ ops1 ++ " m"
|
GenClassPerType -> "PolyplateM (" ++ cName ++ ") " ++ ops0 ++ " " ++ ops1 ++ " m"
|
||||||
where
|
|
||||||
cMunged = mungeName cName
|
|
||||||
GenSlowDelegate -> "PolyplateM' m " ++ ops0 ++ " " ++ ops1 ++ " (" ++ cName ++ ")"
|
GenSlowDelegate -> "PolyplateM' m " ++ ops0 ++ " " ++ ops1 ++ " (" ++ cName ++ ")"
|
||||||
|
|
||||||
|
|
||||||
|
@ -327,6 +325,10 @@ instancesFrom genOverlapped genClass boxes w
|
||||||
,if genClass == GenClassPerType
|
,if genClass == GenClassPerType
|
||||||
then ["class Monad m => PolyplateM" ++ wMunged ++ " o o' m where"
|
then ["class Monad m => PolyplateM" ++ wMunged ++ " o o' m where"
|
||||||
," " ++ funcSameType ++ " :: o -> o' -> (" ++ wName ++ ") -> m (" ++ wName ++ ")"
|
," " ++ funcSameType ++ " :: o -> o' -> (" ++ wName ++ ") -> m (" ++ wName ++ ")"
|
||||||
|
,""
|
||||||
|
,"instance (Monad m, " ++ contextSameType "o0" "o1" ++ ") =>"
|
||||||
|
," PolyplateM (" ++ wName ++ ") o0 o1 m where"
|
||||||
|
," transformM = " ++ funcSameType
|
||||||
]
|
]
|
||||||
else []
|
else []
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user