ivan-m / graphviz

Haskell bindings to the Graphviz toolkit
Other
64 stars 24 forks source link

On why you should use the .cabal bounds as specified #38

Closed recursion-ninja closed 6 years ago

recursion-ninja commented 6 years ago

Pretty-printing libraries seem to still be recovering from misusing the semigroup operator for a decade and the defect is transitively the compilation of your library with GHC version >= 8.4.1.

Qualified imports/usage should fix this.

/tmp/stack24878/graphviz-2999.20.0.2/Data/GraphViz/Printing.hs:135:13: error:
        Ambiguous occurrence ‘<>’
        It could refer to either ‘Prelude.<>’,
                                 imported from ‘Prelude’ at Data/GraphViz/Printing.hs:49:8-29
                                 (and originally defined in ‘GHC.Base’)
                              or ‘PP.<>’,
                                 imported from ‘Text.PrettyPrint.Leijen.Text.Monadic’ at Data/GraphViz/Printing.hs:(79,1)-(85,68)
        |
    135 |   mappend = (<>)
        |             ^^^^

    /tmp/stack24878/graphviz-2999.20.0.2/Data/GraphViz/Printing.hs:285:16: error:
        Ambiguous occurrence ‘<>’
        It could refer to either ‘Prelude.<>’,
                                 imported from ‘Prelude’ at Data/GraphViz/Printing.hs:49:8-29
                                 (and originally defined in ‘GHC.Base’)
                              or ‘PP.<>’,
                                 imported from ‘Text.PrettyPrint.Leijen.Text.Monadic’ at Data/GraphViz/Printing.hs:(79,1)-(85,68)
        |
    285 | wrap b a d = b <> d <> a
        |                ^^

    /tmp/stack24878/graphviz-2999.20.0.2/Data/GraphViz/Printing.hs:285:21: error:
        Ambiguous occurrence ‘<>’
        It could refer to either ‘Prelude.<>’,
                                 imported from ‘Prelude’ at Data/GraphViz/Printing.hs:49:8-29
                                 (and originally defined in ‘GHC.Base’)
                              or ‘PP.<>’,
                                 imported from ‘Text.PrettyPrint.Leijen.Text.Monadic’ at Data/GraphViz/Printing.hs:(79,1)-(85,68)
        |
    285 | wrap b a d = b <> d <> a
        |                     ^^

    /tmp/stack24878/graphviz-2999.20.0.2/Data/GraphViz/Printing.hs:288:26: error:
        Ambiguous occurrence ‘<>’
        It could refer to either ‘Prelude.<>’,
                                 imported from ‘Prelude’ at Data/GraphViz/Printing.hs:49:8-29
                                 (and originally defined in ‘GHC.Base’)
                              or ‘PP.<>’,
                                 imported from ‘Text.PrettyPrint.Leijen.Text.Monadic’ at Data/GraphViz/Printing.hs:(79,1)-(85,68)
        |
    288 | commaDel a b = unqtDot a <> comma <> unqtDot b
        |                          ^^

    /tmp/stack24878/graphviz-2999.20.0.2/Data/GraphViz/Printing.hs:288:35: error:
        Ambiguous occurrence ‘<>’
        It could refer to either ‘Prelude.<>’,
                                 imported from ‘Prelude’ at Data/GraphViz/Printing.hs:49:8-29
                                 (and originally defined in ‘GHC.Base’)
                              or ‘PP.<>’,
                                 imported from ‘Text.PrettyPrint.Leijen.Text.Monadic’ at Data/GraphViz/Printing.hs:(79,1)-(85,68)
        |
    288 | commaDel a b = unqtDot a <> comma <> unqtDot b
        |                                   ^^

    /tmp/stack24878/graphviz-2999.20.0.2/Data/GraphViz/Printing.hs:291:25: error:
        Ambiguous occurrence ‘<>’
        It could refer to either ‘Prelude.<>’,
                                 imported from ‘Prelude’ at Data/GraphViz/Printing.hs:49:8-29
                                 (and originally defined in ‘GHC.Base’)
                              or ‘PP.<>’,
                                 imported from ‘Text.PrettyPrint.Leijen.Text.Monadic’ at Data/GraphViz/Printing.hs:(79,1)-(85,68)
        |
    291 | printField f v = text f <> equals <> toDot v
        |                         ^^

    /tmp/stack24878/graphviz-2999.20.0.2/Data/GraphViz/Printing.hs:291:35: error:
        Ambiguous occurrence ‘<>’
        It could refer to either ‘Prelude.<>’,
                                 imported from ‘Prelude’ at Data/GraphViz/Printing.hs:49:8-29
                                 (and originally defined in ‘GHC.Base’)
                              or ‘PP.<>’,
                                 imported from ‘Text.PrettyPrint.Leijen.Text.Monadic’ at Data/GraphViz/Printing.hs:(79,1)-(85,68)
        |
    291 | printField f v = text f <> equals <> toDot v
        |                                   ^^

    /tmp/stack24878/graphviz-2999.20.0.2/Data/GraphViz/Printing.hs:348:37: error:
        Ambiguous occurrence ‘<>’
        It could refer to either ‘Prelude.<>’,
                                 imported from ‘Prelude’ at Data/GraphViz/Printing.hs:49:8-29
                                 (and originally defined in ‘GHC.Base’)
                              or ‘PP.<>’,
                                 imported from ‘Text.PrettyPrint.Leijen.Text.Monadic’ at Data/GraphViz/Printing.hs:(79,1)-(85,68)
        |
    348 |   unqtDot (BScheme n l) = unqtDot n <> unqtDot l
        |                                     ^^
ivan-m commented 6 years ago

I do not think that:

misusing the semigroup operator for a decade

is a fair characterisation of the situation.

Especially since as of 1.2.0.0, wl-pprint-text no longer exports <> from the Monad module.

So the only way this particular situation could have arisen is if you were deliberately used an old version of wl-pprint-text by bypassing the .cabal file restrictions.

recursion-ninja commented 6 years ago

You're correct, there were incorrect bounds set in the cabal file.