haskell — not understanding why this associated ty

2019-08-27 02:31发布

Consider the following code,

data MyBaseExpr α where
    ConstE :: Show α => α -> MyBaseExpr α

class Monad                 

1条回答
老娘就宠你
2楼-- · 2019-08-27 03:20

ExprTyp is not (necessarily) an injective type function. This means that being handed something of type ExprType m doesn't nail down m -- there may also be a different n such that ExprType n = ExprType m. This makes the type of expTypArg a bit tricky: it uses return-type polymorphism in the same way, e.g., read does, so you'll need to give extra type annotations to its result in the same situations you have to do with read.

查看更多
登录 后发表回答