Skip to content

Instantly share code, notes, and snippets.

@mpickering
Created June 28, 2022 11:21
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/b7e06bc73dab805bf5c7944fd4f282de to your computer and use it in GitHub Desktop.
Save mpickering/b7e06bc73dab805bf5c7944fd4f282de to your computer and use it in GitHub Desktop.
{-# language TemplateHaskell #-}
module TH where
import TH1
import Language.Haskell.TH.Syntax
import Data.Maybe
foo :: String
foo = $(maybe (fail "err") lift $ parseFile $(embedFile "abc"))
module TH1 where
import Language.Haskell.TH
import Language.Haskell.TH.Syntax
embedFile :: String -> Q Exp
embedFile = lift
parseFile :: String -> Maybe String
parseFile = Just
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment