Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is START_FILE a GHC pragma?

Tags:

haskell

Who could provide information regarding START_FILE pragma?

The is no word about START_FILE in GHC Pragmas Documentation. Nevertheless it seems to be widely used [1], [2], [3].

Unfortunately ghc 8.2.2 does not compile following code[1].

{-# START_FILE main.hs #-}
main = readFile "file.txt" >>= putStr

{-# START_FILE file.txt #-}
Hello, world!
like image 348
palik Avatar asked Jul 09 '18 13:07

palik


1 Answers

No, this is an extension specific to School of Haskell Markdown. It's used to provide several "files" in a single Markdown code block.

It's not "widely used" outside of School of Haskell for that reason. When reading such code snippets, simple treat everything after a START_FILE pragma as if it was in a file with the name indicated as the parameter (if it indicates a format like BASE64 you need to put the decoded bytes into the file instead).

like image 146
Cubic Avatar answered Sep 26 '22 18:09

Cubic