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

Some advanced Haskell features make this hard because constraints like 'a is a number' are solved separately. For instance

    data Tag a where
        IsInt :: Tag Int
        IsDouble :: Tag Double

    someNum :: Num a => a
    someNum = 3 * 4 + 5

    pickNum :: Tag a -> a
    pickNum IsInt = someNum
    pickNum IsDouble = someNum * 2.5
Constraints can be delayed and changed by pattern matching, so the origin might not be obvious. There are ways around this, but they require tracking why values are set and to propagate this information around. Haskell has Turing complete type level functions so you have to figure out how they propagate this dependency information.

GHC handles some easy cases, if you compiler in a file it does point to `+`, but it can get hairy. Also, currying can make it harder to say 'you swapped to arguments'



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

Search: