{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE Trustworthy #-}
module Language.Futhark.Prelude (prelude) where
import Data.FileEmbed
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import Futhark.Util (toPOSIX)
import qualified System.FilePath.Posix as Posix
prelude :: [(Posix.FilePath, T.Text)]
prelude :: [(FilePath, Text)]
prelude = ((FilePath, ByteString) -> (FilePath, Text))
-> [(FilePath, ByteString)] -> [(FilePath, Text)]
forall a b. (a -> b) -> [a] -> [b]
map (FilePath, ByteString) -> (FilePath, Text)
fixup [(FilePath, ByteString)]
prelude_bs
where
prelude_bs :: [(FilePath, ByteString)]
prelude_bs = $(embedDir "prelude")
fixup :: (FilePath, ByteString) -> (FilePath, Text)
fixup (FilePath
path, ByteString
s) = (FilePath
"/prelude" FilePath -> FilePath -> FilePath
Posix.</> FilePath -> FilePath
toPOSIX FilePath
path, ByteString -> Text
T.decodeUtf8 ByteString
s)