Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

maybe a

  type Test (c :: Constraint) = c => ()
is in order here ;)

  testTheObvious :: Test ((2 + 2) ~ 5)
  testTheObvious = ()


That compiles though. You need to CPS the constraint as in my example above. This does the job:

    type Test (c :: Constraint) = forall a. (c => a) -> a
    
    testTheObvious :: Test ((2 + 2) ~ 5)
    testTheObvious = id




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: