lymar / hastache

Haskell implementation of Mustache template
Other
96 stars 16 forks source link

hastache-0.6.1 doesn't compile with GHC 7.10.1 #47

Open peti opened 9 years ago

peti commented 9 years ago

Citing from http://hydra.cryp.to/build/719531/log/raw:

Preprocessing test suite 'test-hastache' for hastache-0.6.1...
[1 of 1] Compiling Main             ( tests/test.hs, dist/build/test-hastache/test-hastache-tmp/Main.dyn_o )

tests/test.hs:220:5:
    Non type-variable argument in the constraint: MonadWriter T.Text m
    (Use FlexibleContexts to permit this)
    When checking that ‘context’ has the inferred type
      context :: forall (m :: * -> *).
                 MonadWriter T.Text m =>
                 [Char] -> MuType m
    In an equation for ‘lambdaMSectionTest’:
        lambdaMSectionTest
          = do { (res, writerState) <- runWriterT monadicFunction;
                 assertEqualStr resCorrectness (decodeStrLT res) testRes;
                 assertEqualStr
                   "monad state correctness" (decodeStr writerState) testMonad }
          where
              monadicFunction
                = hastacheStr
                    defaultConfig (encodeStr template) (mkStrContext context)
              template
                = "[{{#mf}}abc{{/mf}}]\n\
                  \[{{#mf}}def{{/mf}}]\n"
              context "mf" = MuLambdaM $ \ i -> ...
              testRes
                = "[cba]\n\
                  \[fed]\n"
              ....

tests/test.hs:239:5:
    Non type-variable argument in the constraint: MonadError [Char] m
    (Use FlexibleContexts to permit this)
    When checking that ‘context’ has the inferred type
      context :: forall (m :: * -> *) (m1 :: * -> *).
                 MonadError [Char] m =>
                 [Char] -> m (MuType m1)
    In an equation for ‘monadicContextTest’:
        monadicContextTest
          = do { r <- runErrorT
                      $ hastacheStr
                          defaultConfig (encodeStr template) (mkStrContextM context);
                 let res = ...;
                 assertEqualStr resCorrectness res testRes }
          where
              template
                = "Hello, {{name}}! You have {{unread}} unread messages. {{some}}"
              context "name" = return $ MuVariable "Haskell"
              context "unread" = return $ MuVariable (100 :: Int)
              context var = throwError $ "{{" ++ var ++ "}} not found!"
              testRes = "error: {{some}} not found!"
nomeata commented 9 years ago

It would be nice to have this fixed, given hastache is a dependency of criterion.

qrilka commented 8 years ago

Addressed by #50