Created
November 11, 2017 21:07
-
-
Save cartazio/a42054587f1f8bc0c5720d48ee166049 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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