nikita-volkov / neat-interpolation

A quasiquoter for neat and simple multiline text interpolation
http://hackage.haskell.org/package/neat-interpolation
MIT License
55 stars 16 forks source link

Example in haddocks misses languages extensions #30

Closed ulysses4ever closed 2 years ago

ulysses4ever commented 2 years ago

Example reads:

import NeatInterpolation
import Data.Text (Text)

f :: Text -> Text -> Text
f a b =
  [trimming|
    function(){
      function(){
        $a
      }
      return $b
    }
  |]

Given that imports are there I expect it to be a standalone example that is runnable. But that's not true: it misses:

{-# LANGUAGE QuasiQuotes, OverloadedStrings #-}

Would it be possible to add these? I think it will make the documentation friendlier.

nikita-volkov commented 2 years ago

Good idea! Could you PR?

ulysses4ever commented 2 years ago

Oh, this is funny: the source does have the language pragma (no need in OverloadedStrings, of course), but Haddock did not render it for some reason:

It seems like Haddock's bug...

ulysses4ever commented 2 years ago

Okay, this seems to be a known (mis)feature of Haddock: https://github.com/haskell/haddock/issues/1254 which may or may not be fixed in the future. The workaround is to use single-line comments. Submitted #31 with the workaround, but I will understand if you won't be willing to accept it.