-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Unicode file embedding: embedStringFile → embedFileUtf8
- Loading branch information
Showing
3 changed files
with
30 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{-# LANGUAGE TemplateHaskell #-} | ||
|
||
module Spago.TH | ||
( embedFileUtf8 | ||
) where | ||
|
||
import Data.FileEmbed | ||
import Data.Text.Encoding as LT | ||
import Language.Haskell.TH.Syntax (Exp, Q) | ||
|
||
|
||
-- | This is here so that we can embed files as Utf8 Text. | ||
-- The reason for that is that since we have unicode Dhall files, | ||
-- if you compile on a non-unicode system you'll get weirdly encoded stuff. | ||
-- | ||
-- TL;DR: don't use embedStringFile. | ||
-- | ||
-- This comes from: | ||
-- https://github.com/snoyberg/file-embed/issues/27#issuecomment-411694346 | ||
embedFileUtf8 :: FilePath -> Q Exp | ||
embedFileUtf8 filePath = | ||
[| LT.decodeUtf8 $(makeRelativeToProject filePath >>= embedFile) |] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ dependencies: | |
- prettyprinter | ||
- async-pool | ||
- process | ||
- template-haskell | ||
|
||
executables: | ||
spago: | ||
|