Discussion:
[Haskell-cafe] Is there some way to hack the type system without recompiling GHC?
ducis
2018-11-23 06:11:29 UTC
Permalink
We know that the type system is now a second language where you spec formal requirements and let the compiler solve it, kinda like logic programming.
But sometimes I knew something is correct or at least willing to take the risk of runtime errors, but the typechecker is not (yet) able to figure it out.
In this case is it possible to somehow insert (regular haskell) code into the typechecker and force the compiler to think some values are of some types,
rather than waiting for or inventing some formally correct solution, which may be fundamentally very difficult?
Dan Burton
2018-11-24 06:23:18 UTC
Permalink
"force the compiler to think some values are of some types"

Sounds like a job for unsafeCoerce.
Post by ducis
We know that the type system is now a second language where you spec
formal requirements and let the compiler solve it, kinda like logic
programming.
But sometimes I knew something is correct or at least willing to take the
risk of runtime errors, but the typechecker is not (yet) able to figure it
out.
In this case is it possible to somehow insert (regular haskell) code into
the typechecker and force the compiler to think some values are of some
types,
rather than waiting for or inventing some formally correct solution, which
may be fundamentally very difficult?
_______________________________________________
Haskell-Cafe mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Carter Schonwald
2018-11-29 14:26:20 UTC
Permalink
Which is safe as long as the GC ETC still can walk it correctly! And that
you’re not rereferencing an Int as a list of A :)
Post by Dan Burton
"force the compiler to think some values are of some types"
Sounds like a job for unsafeCoerce.
Post by ducis
We know that the type system is now a second language where you spec
formal requirements and let the compiler solve it, kinda like logic
programming.
But sometimes I knew something is correct or at least willing to take the
risk of runtime errors, but the typechecker is not (yet) able to figure it
out.
In this case is it possible to somehow insert (regular haskell) code into
the typechecker and force the compiler to think some values are of some
types,
rather than waiting for or inventing some formally correct solution,
which may be fundamentally very difficult?
_______________________________________________
Haskell-Cafe mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
_______________________________________________
Haskell-Cafe mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Loading...