[Haskell-cafe] Why does this result in a runtime loop instead of a type error or typechecker loop?

Theodore Lief Gannon tanuki at gmail.com
Mon Jul 23 21:10:45 UTC 2018

λ. :set -XFlexibleContexts -XFlexibleInstances -XMultiParamTypeClasses
λ. import RIO
λ. import Data.Has
λ. class HasBool a where boolL :: Lens' a Bool
λ. instance {-#OVERLAPPABLE#-} HasBool a => Has Bool a where hasLens = boolL
λ. instance {-#OVERLAPPABLE#-} Has Bool a => HasBool a where boolL = hasLens
λ. runRIO () $ view boolL

The RIO environment () doesn't contain a Bool. I can see how the
typechecker might get lost in this, but I can compile an equivalent
program; it loops on execution.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180723/2a97b788/attachment.html>

More information about the Haskell-Cafe mailing list