Skip to content

Instantly share code, notes, and snippets.

@cartazio
Created November 11, 2017 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cartazio/a42054587f1f8bc0c5720d48ee166049 to your computer and use it in GitHub Desktop.
Save cartazio/a42054587f1f8bc0c5720d48ee166049 to your computer and use it in GitHub Desktop.
module BadUncurry where
import Control.Exception
data Fst a = Only a deriving (Show, Typeable, Exception)
badFst :: (Typeable a, Show a) => a -> b -> c
badFst a = throw (Only a)
notOnly (Only a) = a
nonLinear :: (Show a, Typeable a) => (a, b) -> IO a
nonLinear pr = catch
(return (uncurry badFst pr))
(return . notOnly)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment