[Haskell-cafe] how to catch keyboard interrupts?

Uwe Hollerbach uhollerbach at gmail.com
Sun Feb 24 17:24:47 EST 2008


Thanks, I'll try that. -- Uwe

On 2/24/08, Ryan Ingram <ryani.spam at gmail.com> wrote:
> This is pretty cool, but I have one warning:
>
>  On Sat, Feb 23, 2008 at 4:37 PM, Uwe Hollerbach <uhollerbach at gmail.com> wrote:
>  >  > data MyInterrupt = MyInt Int
>  >  > instance Typeable MyInterrupt where
>  >  >   typeOf x = typeOf (0 :: Int)
>
>  I am pretty sure that this makes Dynamic unsound; you could
>  accidentally cast from an Int to a MyInterrupt or vice versa.  Try
>  this instead:
>
>  > data MyException = Interrupt deriving Typeable
>
>  then you can safely use throwDyn and catchDyn on this type.
>
>
>    -- ryan
>


More information about the Haskell-Cafe mailing list