-
-
Save mpickering/b6919b13abe0954fdad844e16e0edb48 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
{-# LANGUAGE ImplicitParams #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
module A where | |
import Language.Haskell.TH | |
import Data.List (sortBy) | |
sort :: (?cmp :: a -> a -> Ordering) => [a] -> [a] | |
sort = sortBy ?cmp | |
me :: Q (TExp ([Int] -> [Int])) | |
me = | |
let ?cmp = compare in [|| sort ||] |
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
{-# LANGUAGE ImplicitParams #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
module B where | |
import A | |
foo :: [Int] -> [Int] | |
foo = | |
--let ?cmp = compare in | |
$$(me) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment