Skip to content

Instantly share code, notes, and snippets.

@phadej
Created March 18, 2020 16:15
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 phadej/89860fac0ddd7410cb02a8eb6e632ada to your computer and use it in GitHub Desktop.
Save phadej/89860fac0ddd7410cb02a8eb6e632ada to your computer and use it in GitHub Desktop.

First build:

% cabal v2-build -w ghc-8.8.3

(I tried at v2.6 tag)

Then run test

% cabal v2-exec -w ghc-8.8.3 -- sh script.sh
Loaded package environment from /code/other-haskell/singletons/hack-env-file
tests/compile-and-dump/Promote/Pragmas.hs:(6,3)-(10,3): Splicing declarations
    promote
      [d| {-# INLINE foo #-}
          foo :: Bool
          foo = True |]
  ======>
    {-# INLINE foo #-}
    foo :: Bool
    foo = True
    type FooSym0 = Foo
    type family Foo :: Bool where
      Foo = TrueSym0

The template is

% cat tests/compile-and-dump/Promote/Pragmas.ghc88.template 
Promote/Pragmas.hs:(0,0)-(0,0): Splicing declarations
    promote
      [d| {-# INLINE foo #-}
          foo :: Bool
          foo = True |]
  ======>
    {-# INLINE foo #-}
    foo :: Bool
    foo = True
    type FooSym0 = Foo
    type family Foo :: Bool where
      Foo = TrueSym0
cp "$GHC_ENVIRONMENT" hack-env-file
echo "package-id singletons-2.6-inplace" >> hack-env-file
GHC_ENVIRONMENT=$(pwd)/hack-env-file
export GHC_ENVIRONMENT
FLAGS="-v0 -c -ddump-splices -dsuppress-uniques -fforce-recomp -fprint-explicit-kinds -O0 -XTemplateHaskell -XDataKinds -XKindSignatures -XTypeFamilies -XTypeOperators -XMultiParamTypeClasses -XGADTs -XFlexibleInstances -XUndecidableInstances -XRankNTypes -XScopedTypeVariables -XPolyKinds -XFlexibleContexts -XIncoherentInstances -XLambdaCase -XUnboxedTuples -XInstanceSigs -XDefaultSignatures -XCPP -XStandaloneDeriving -XTypeApplications -XEmptyCase -XNoStarIsType"
ghc-8.8.3 $FLAGS tests/compile-and-dump/Promote/Pragmas.hs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment