1
有没有简化包含类的函数类型头的方法?命名类实例
现在我写
myfce :: Graph gr => Sometype -> gr Int String
,我想
myfce :: Sometype -> MyGraph
有没有简化包含类的函数类型头的方法?命名类实例
现在我写
myfce :: Graph gr => Sometype -> gr Int String
,我想
myfce :: Sometype -> MyGraph
如果MyGraph
是x Int String
一种代名词,其中x
是Graph
一个实例,那么你可以这样做:
data GraphType a b = ...
instance Graph GraphType where ...
type MyGraph = GraphType Int String
您可以然后专门myfce
有你想要的类型
myfce :: Sometype -> MyGraph