Techniques for Tracing Constraints

前端 未结 2 1108
长发绾君心
长发绾君心 2021-01-29 23:32

Here\'s the scenario: I\'ve written some code with a type signature and GHC complains could not deduce x ~ y for some x and y. You can usually throw GH

2条回答
  •  -上瘾入骨i
    2021-01-29 23:59

    Did you try this in GHC 8.8+?

    share :: (Let :<: sup,
              Domain a ~ sup,
              Domain b ~ sup,
              SyntacticN (a -> (a -> b) -> b) fi,
              _) 
          => a -> (a -> b) -> a
    share = sugarSym Let
    

    The key is to use type hole among constraints: _ => your difficult type

提交回复
热议问题