Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Pragmas ignored in \iohatex{...}? #7

Open
fedeinthemix opened this issue Jun 27, 2017 · 1 comment
Open

Pragmas ignored in \iohatex{...}? #7

fedeinthemix opened this issue Jun 27, 2017 · 1 comment
Assignees

Comments

@fedeinthemix
Copy link

Hi,

I've written a custom function called includeSnippet with the following signature

includeSnippet :: FilePath -> Text -> LaTeXT IO Text

In my .htex file I include

\begin{haskellpragmas}
{-# LANGUAGE OverloadedStrings #-}
\end{haskellpragmas}

However, if I don't use pack for the second argument haskintex gives the following error:

$ haskintex -verbose -keep test_3.htex 
Info: memotree does not exist.
-> Using empty memotree.
Enabled flags: keep, verbose.
Reading test_3.htex...
Creating Haskell source file Haskintex_test_3.hs...
Evaluating expressions in test_3.htex...
Evaluation (IO LaTeX): execLaTeXT (includeSnippet "src/fact.hs" "ex1" >>= verbatim)
Warning: Error while evaluating the expression.
Compiler error:
<interactive>:2:42: error:
    • Couldn't match expected type ‘Text’ with actual type ‘[Char]’
    • In the second argument of ‘includeSnippet’, namely ‘"ex1"’
      In the first argument of ‘(>>=)’, namely
        ‘includeSnippet "src/fact.hs" "ex1"’
      In the first argument of ‘execLaTeXT’, namely
        ‘(includeSnippet "src/fact.hs" "ex1" >>= verbatim)’
File test_3.tex already exists. Overwrite? (use -overwrite to overwrite by default) y
Writing final file at test_3.tex...
End of processing of file test_3.htex.

It seems that during evaluation of the \iohatex{...} expressions, pragmas are ignored.

@Daniel-Diaz Daniel-Diaz self-assigned this Jul 2, 2017
@Daniel-Diaz
Copy link
Owner

You are right, pragmas do not affect evaluation of either \hatex{...} or \iohatex{...}. There is no trivial fix for this. What I can do is parse the pragmas and then pass them to the evaluation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants