Created
August 13, 2024 05:53
-
-
Save nghamilton/551cd612390336a4a4d9fedd81fe0023 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
{-# LANGUAGE ImplicitParams #-} | |
{-# LANGUAGE DeepSubsumption #-} | |
import Prelude | |
main :: IO () | |
main = let ?implicit = "yeah" in flipOut printImplicit | |
where | |
printImplicit :: (?implicit :: String) => IO () | |
printImplicit = putStrLn ?implicit | |
f :: forall a b. (?implicit :: String) => b -> ((?implicit :: String) => a) -> a | |
f _wotevs i = let ?implicit = "nah" in i | |
-- Using `flip` produces a different result. | |
flipOut :: (?implicit :: String) => ((?implicit :: String) => a) -> a | |
flipOut a = flip f a undefined | |
flipOut a = f undefined a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://ghc-proposals.readthedocs.io/en/latest/proposals/0511-deep-subsumption.html#id5