{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreibwrvj5iaz65t26woxmbyht5pbqxifpbbie7c4igckch3dfzkzbhy",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mjgvjrfnl3f2"
},
"path": "/t/type-level-programming-dealing-with-ambiguous-type-error/13828#post_12",
"publishedAt": "2026-04-14T07:27:15.000Z",
"site": "https://discourse.haskell.org",
"textContent": "tomjaguarpaw:\n\n> What _will_ allow you to do that is `forall ->`.\n\nNo, matching on types is not (and should not be) possible even with full dependent types like in Agda. I hope this is not a planned feature.\n\nWhat you can do is create a data type and map that to the type level:\n\n\n data MyType = TInt | TBool\n\n typeOfMyType :: MyType -> Type\n typeOfMyType TInt = Int\n typeOfMyType TBool = Bool\n\n negateLike :: forall (t :: MyType) -> typeOfMyType t -> typeOfMyType t\n negateLike TInt x = -x\n negateLike TBool x = not x\n",
"title": "Type level programming: Dealing with ambiguous type error"
}