[Haskell-cafe] exceptions vs. Eithers

John Meacham john at repetae.net
Wed Aug 4 16:26:46 EDT 2004

I always thought it would be a good feature if functions inlined via 
{-# INLINE #-} could 'get at' their inlining point. like

{-# INLINE head #-}

head (x:_) = x
head _ = error $ {-# ERRLOC #-} "head: empty list"

the semantics being that when inlining {-# ERRLOC #-} is rewritten to
(\s -> "Foo.hs:24: " ++ s)  (with Foo.hs and 24 replaced by the inlining

Note that this is designed so that if the compiler does not support
ERRLOC or head could not be inlined for some reason, it degrades

John Meacham - ⑆repetae.net⑆john⑈ 

More information about the Haskell-Cafe mailing list