• Oleg Grenrus's avatar
    Correct doctests · aa17b84d
    Oleg Grenrus authored
    It's simpler to assume that base is NoImplicitPrelude,
    otherwise running doctest on `GHC.*` modules would be tricky.
    OTOH, most `GHC.List` (where the most name clashes are) examples
    could be changed to use `import qualified Data.List as L`.
    (GHC.List examples won't show for Foldable methods...).
    With these changes majority of doctest examples are GHCi-"faithful",
    my WIP GHC-independent doctest runner reports nice summary:
    Examples: 582; Tried: 546; Skipped: 34; Success: 515; Errors: 33; Property Failures 2
    Most error cases are *Hangs forever*.
    I have yet to figure out how to demonstrate that in GHCi.
    Some of divergences are actually stack overflows, i.e. caught by
    Few errorful cases are examples of infinite output, e.g.
        >>> cycle [42]
    while correct, they confuse doctest.
    Another erroneous cases are where expected output has line comment, like
        >>> fmap show (Just 1)  --  (a   -> b)      -> f a       -> f b
        Just "1"                --  (Int -> String) -> Maybe Int -> Maybe String
    I think I just have to teach doctest to strip comments from expected
    This is a first patch in a series.
    There is plenty of stuff already.
Unicode.hs 13.2 KB