-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doctest fails to allocate memory #271
Comments
Is there a handy way of trying to reproduce this locally? e.g., I assume that it's not just a long command line that's the trigger, otherwise |
I'm afraid I don't have a minimal repro. My guess is that it's more the number of packages being loaded, rather than the length of the command line. I can get |
Ok, I weirdly found the problem. Here's the diff that I need to stop @@ -57,12 +57,6 @@ import qualified Data.MonotoneMap as MonotoneMap
import Data.Ratio.Extra
-{-# ann module "HLint: ignore Evaluate" #-}
-
-
-{-# ann module "HLint: ignore Use let" #-}
-
-
-- | Burden rates per role in $/hour
rates :: Durations Rational
rates =
``
That's right, it seems that module annotations are the source of the problem! |
Ok, I might be slightly wrong there. The diff above is from a different branch I'm working on, but it doesn't fix {-# language TemplateHaskell #-}
{-# language TypeFamilies #-}
module Data.Units.US.Money where
-- units
import Data.Metrology
import Data.Metrology.TH
declareDimension "Cost"
declareCanonicalUnit "Dollar" [t| Cost |] ( Just "USD" )
type instance DefaultUnitOfDim Cost =
Dollar
declareDerivedUnit "Cent" [t| Dollar |] ( 1 / 100 ) ( Just "cent" ) |
It seems to be related to actually starting the TH interpreter. If I compile this module with {-# language TypeFamilies #-}
module Data.Units.US.Money where
-- units
import Data.Metrology
data Cost = Cost
instance Dimension Cost
data Dollar = Dollar
instance Unit Dollar where
type BaseUnit Dollar = Canonical
type DimOfUnit Dollar = Cost
instance Show Dollar where
show _ = "USD"
type instance DefaultUnitOfDim Cost =
Dollar
data Cent = Cent
instance Unit Cent where
type BaseUnit Cent = Dollar
conversionRatio _ = 1.0e-2
instance Show Cent where
show _ = "cent" Which |
Ok, final update - the
Allows |
I had a go at reproducing this in https://github.com/quasicomputational/doctest-271 but If you've still got the reproducer handy, can you see if haddock works on it? doctest and haddock are actually quite similar: if haddock works, then it's some kind of doctest-specific bug, but if haddock fails it may ultimately be a GHC issue. |
I unfortunately don't have a reproducible case around anymore. I'll close this for now. Hopefully the trail above may help anyone else who runs into this! |
Seems I have this issue on ghc-8.10.3 on Linux (works on macOS). Is there any fix I can try to recipe how to debug it? It's a huge project with TH and seems that not all the packages with TH fails, so I'm not sure if I can extract the minimal case. |
Try haddocking the project as above, and also manually going in with GHCi and trying some of the doctest examples. If either of those break, it's fundamentally going to be a GHC issue. Otherwise, I'm not sure there's much for it except lopping off leaf modules or removing doctests and seeing if things still break. |
I'm using
cabal-doctest
and the following whopper of a command line is built:If I call
ghci
with these exact same arguments, it works - so I guess this is something specific to doctest.The text was updated successfully, but these errors were encountered: