Skip to content

Commit

Permalink
produce static compilation error due to TemplateHaskell
Browse files Browse the repository at this point in the history
Should we try this? NixOS/nixpkgs#61575 (comment)
  • Loading branch information
vst committed Jul 24, 2022
1 parent eee6ab2 commit 53e2c03
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/Main.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{-# LANGUAGE TemplateHaskell #-}

module Main where

import TH (static42)


main :: IO ()
main = putStrLn "Hello, Haskell!"
main = putStrLn $ "Hello, Haskell! It is " <> show $static42 <> "."
13 changes: 13 additions & 0 deletions app/TH.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{-# LANGUAGE TemplateHaskellQuotes #-}

module TH where

import Language.Haskell.TH ( Exp, Q )


the42 :: Int
the42 = 42


static42 :: Q Exp
static42 = [| the42 |]
6 changes: 5 additions & 1 deletion haskell-static-compilation-example.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ extra-source-files: CHANGELOG.md

executable haskell-static-compilation-example
main-is: Main.hs
build-depends: base ^>=4.15.1.0
build-depends:
base ^>=4.15.1.0
, template-haskell
other-modules:
TH
hs-source-dirs: app
default-language: Haskell2010

0 comments on commit 53e2c03

Please sign in to comment.