Skip to content

Instantly share code, notes, and snippets.

@mpickering
Created November 6, 2018 10: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 mpickering/b6919b13abe0954fdad844e16e0edb48 to your computer and use it in GitHub Desktop.
Save mpickering/b6919b13abe0954fdad844e16e0edb48 to your computer and use it in GitHub Desktop.
{-# 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 ||]
{-# 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