[Haskell-cafe] Documenting the impossible

Isaac Dupree isaacdupree at charter.net
Sat Jun 14 19:41:59 EDT 2008

Neil Mitchell wrote:
>>> * abort - deliberate aborting because the user made some mistake.
>>  This is an exception. The signature of a function must reflect this by a
>> Maybe, Either type etc.
> Disagree. I mean more like:
> when (Delete `elem` flags && Keep `elem` flags) $
>    abort "User cannot pick both keep and delete on the command line"
> Think "die" in Perl world.

in that case should use abort :: String -> IO a, not abort :: String -> 
a.  "abort" as "pure function" is just for messy scripting convenience 
a-la Perl.  (Which is not to say that's never useful, of course -- I 
would just try my hardest to avoid it in my code, probably.)

On the other hand, Control.Exception.throw, if it's ever useful, 
obviously isn't meant to indicate a programmer error, but to throw an 
exception (that will probably be caught somewhere in the program's IO). 
  So there's a reason for _|_ besides programmer error (well, there's 
also user-driven nontermination such as when an interpreter is told to 
execute an infinite loop :-)


More information about the Haskell-Cafe mailing list