[Haskell-cafe] Manual type-checking in graphs: Avoidable?
Kosyrev Serge
_deepfire at feelingofgreen.ru
Sat Feb 20 12:18:28 UTC 2016
Jeffrey Brown <jeffbrown.the at gmail.com> writes:
> After further study I believe existentials are not (at least alone)
> enough to solve the problem.
..
> getInt :: ShowBox -> Int
> getInt (SB i) = i
>
> will not compile, because it cannot infer that i is an Int:
You take a value of an existentially quantified type (which means it
can be anything at all, absent some extra context) and *proclaim* it
is an integer.
On what grounds should the compiler accept your optimistic restriction?
--
с уважениeм / respectfully,
Косырев Сергей
More information about the Haskell-Cafe
mailing list