0

When I try loading my Heist (0.11) templates with this function:

load :: MonadIO n => FilePath -> [(Text, Splice n)] -> IO (HeistState n)
load baseDir splices = do
    tmap <- runEitherT  $ do
        templates <- loadTemplates baseDir
        let hc = HeistConfig [] defaultLoadTimeSplices splices [] templates
        initHeist hc
    either (error . concat) return tmap

I get this error:

Couldn't match expected type `EitherT e0 m0 t0'
            with actual type `either-3.1:Control.Monad.Trans.Either.EitherT
                                [String] IO Heist.TemplateRepo'
In the return type of a call of `loadTemplates'
In a stmt of a 'do' block: templates <- loadTemplates baseDir
In the second argument of `($)', namely
  `do { templates <- loadTemplates baseDir;
        let hc
              = HeistConfig [] defaultLoadTimeSplices splices [] templates;
        initHeist hc }'

To me, loadTemplate seems to be returning the expected type, except with the type parameters filled in with concrete types. What am I missing?

dan
  • 43,914
  • 47
  • 153
  • 254
  • 4
    This looks like a broken package setup - notice how it refers to a type by a particular package version? That is a strong indicator that you have a Dependency problem. – Thomas M. DuBuisson Feb 09 '13 at 20:41
  • The imports used for `load` and the imports used for `loadTemplates` are getting `EitherT` from different definitions in different modules or versions or packages. – Chris Kuklewicz Feb 10 '13 at 11:56
  • 1
    This happens in cases where there are multiple versions of the same package installed. Use ghc-pkg to remove all but one version of the either package, then reinstall and try it again. – mightybyte Feb 11 '13 at 16:38

1 Answers1

1

This happens in cases where there are multiple versions of the same package installed. Use ghc-pkg to remove all but one version of the either package, then reinstall and try it again.

I've been puzzled by this time and time again. When the types are right and you start to think it's a GHC bug, check for duplicate packages.

mightybyte
  • 7,282
  • 3
  • 23
  • 39