DanielSchuessler / logic-TPTP

Import, export etc. for TPTP, a syntax for first-order logic
GNU General Public License v3.0
3 stars 2 forks source link

Incompatibility with ansi-wl-pprint-1.0.2 #30

Closed msakai closed 16 hours ago

msakai commented 1 year ago

I encountered the following error when I tried to compile logic-TPTP (v0.5.0.0 or master (19b25627cff915c8c5224395e3154832a0073bf3)) with ansi-wl-pprint-1.0.2

[ 4 of 11] Compiling Codec.TPTP.Pretty

/Users/sakai/src/logic-TPTP/Codec/TPTP/Pretty.hs:195:1: error:
    Duplicate instance declarations:
      instance [overlap ok] Pretty a => Pretty (Identity a)
        -- Defined at Codec/TPTP/Pretty.hs:195:1
      instance [safe] Pretty a => Pretty (Identity a)
        -- Defined in ‘prettyprinter-1.7.1:Prettyprinter.Internal’

If I comment out the line:

https://github.com/DanielSchuessler/logic-TPTP/blob/19b25627cff915c8c5224395e3154832a0073bf3/Codec/TPTP/Pretty.hs#L195

It resulted in the following errors:

[ 4 of 11] Compiling Codec.TPTP.Pretty

/Users/sakai/src/logic-TPTP/Codec/TPTP/Pretty.hs:96:11: error:
    • Couldn't match type ‘ann’
                     with ‘prettyprinter-ansi-terminal-1.1.3:Prettyprinter.Render.Terminal.Internal.AnsiStyle’
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      ‘ann’ is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    TPTP_Input -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at Codec/TPTP/Pretty.hs:95:5-10
    • In the expression:
        (text) "Formula " <+> (dullwhite . text) "name:"
          </>
            vsep
              [(red . pretty) name <+> dullwhite (text "role:")
                 <+> (magenta . text . unrole) role,
               pretty formula, pretty annotations, empty]
      In an equation for ‘pretty’:
          pretty AFormula {..}
            = (text) "Formula " <+> (dullwhite . text) "name:"
                </>
                  vsep
                    [(red . pretty) name <+> dullwhite (text "role:")
                       <+> (magenta . text . unrole) role,
                     pretty formula, pretty annotations, ....]
      In the instance declaration for ‘Pretty TPTP_Input’
    • Relevant bindings include
        pretty :: TPTP_Input
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at Codec/TPTP/Pretty.hs:95:5)
   |
96 |         = (text) "Formula " <+> (dullwhite.text) "name:"
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

/Users/sakai/src/logic-TPTP/Codec/TPTP/Pretty.hs:112:34: error:
    • Couldn't match type ‘ann’
                     with ‘prettyprinter-ansi-terminal-1.1.3:Prettyprinter.Render.Terminal.Internal.AnsiStyle’
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      ‘ann’ is a rigid type variable bound by
        the type signature for:
          prettyList :: forall ann.
                        [TPTP_Input] -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at Codec/TPTP/Pretty.hs:112:5-14
    • In the expression: pretty x <$> xs
      In the first argument of ‘foldr’, namely
        ‘(\ x xs -> pretty x <$> xs)’
      In the expression: foldr (\ x xs -> pretty x <$> xs) empty
    • Relevant bindings include
        xs :: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at Codec/TPTP/Pretty.hs:112:28)
        prettyList :: [TPTP_Input]
                      -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at Codec/TPTP/Pretty.hs:112:5)
    |
112 |     prettyList = foldr (\x xs -> pretty x <$> xs) empty
    |                                  ^^^^^^^^^^^^^^^

/Users/sakai/src/logic-TPTP/Codec/TPTP/Pretty.hs:115:18: error:
    • Couldn't match type ‘ann’
                     with ‘prettyprinter-ansi-terminal-1.1.3:Prettyprinter.Render.Terminal.Internal.AnsiStyle’
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      ‘ann’ is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    Quant -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at Codec/TPTP/Pretty.hs:115:5-10
    • In the expression: oper "∀"
      In an equation for ‘pretty’: pretty All = oper "∀"
      In the instance declaration for ‘Pretty Quant’
    • Relevant bindings include
        pretty :: Quant
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at Codec/TPTP/Pretty.hs:115:5)
    |
115 |     pretty All = oper "∀"
    |                  ^^^^^^^^

/Users/sakai/src/logic-TPTP/Codec/TPTP/Pretty.hs:132:11: error:
    • Couldn't match type ‘ann’
                     with ‘prettyprinter-ansi-terminal-1.1.3:Prettyprinter.Render.Terminal.Internal.AnsiStyle’
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      ‘ann’ is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    WithEnclosing (Formula0 t f)
                    -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at Codec/TPTP/Pretty.hs:119:5-10
    • In the expression:
        maybeParens newEnclosing enclosing
          $ case formu of
              Quant q vars f
                -> pretty q
                     <+> brackets (hsep (punctuate comma (fmap pretty vars)))
                     <> dot </> pretty (wne f)
              (:~:) f -> oper "¬" <+> pretty (wne f)
              PredApp p [] -> psym p
              PredApp p args -> psym p <> prettyargs (fmap wne args)
              BinOp f1 op f2
                -> align $ sep [indent 0 $ pretty (wne f1), pretty op, ....]
              InfixPred f1 op f2
                -> align $ sep [indent 0 $ pretty (wne f1), pretty op, ....]
      In the expression:
        let
          newEnclosing
            = case formu of
                Quant _ _ _ -> ...
                PredApp _ _ -> ...
                (:~:) _ -> ...
                BinOp _ op _ -> ...
                InfixPred _ op _ -> ...
          wne = WithEnclosing newEnclosing
        in
          maybeParens newEnclosing enclosing
            $ case formu of
                Quant q vars f
                  -> pretty q
                       <+> brackets (hsep (punctuate comma (fmap pretty vars)))
                       <> dot </> pretty (wne f)
                (:~:) f -> oper "¬" <+> pretty (wne f)
                PredApp p [] -> psym p
                PredApp p args -> psym p <> prettyargs (fmap wne args)
                BinOp f1 op f2 -> align $ sep [indent 0 $ pretty (wne f1), ....]
                InfixPred f1 op f2
                  -> align $ sep [indent 0 $ pretty (wne f1), ....]
      In an equation for ‘pretty’:
          pretty (WithEnclosing enclosing formu)
            = let
                newEnclosing = ...
                wne = WithEnclosing newEnclosing
              in
                maybeParens newEnclosing enclosing
                  $ case formu of
                      Quant q vars f
                        -> pretty q
                             <+> brackets (hsep (punctuate comma (fmap pretty vars)))
                             <> dot </> pretty (wne f)
                      (:~:) f -> oper "¬" <+> pretty (wne f)
                      PredApp p [] -> psym p
                      PredApp p args -> psym p <> prettyargs (fmap wne args)
                      BinOp f1 op f2 -> align $ sep [...]
                      InfixPred f1 op f2 -> align $ sep [...]
    • Relevant bindings include
        pretty :: WithEnclosing (Formula0 t f)
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at Codec/TPTP/Pretty.hs:119:5)
    |
132 |           maybeParens newEnclosing enclosing $
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

/Users/sakai/src/logic-TPTP/Codec/TPTP/Pretty.hs:156:20: error:
    • Couldn't match type ‘ann’
                     with ‘prettyprinter-ansi-terminal-1.1.3:Prettyprinter.Render.Terminal.Internal.AnsiStyle’
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      ‘ann’ is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    BinOp -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at Codec/TPTP/Pretty.hs:155:5-10
    • In the expression: oper "⇔"
      In a case alternative: (:<=>:) -> oper "⇔"
      In the expression:
        case x of
          (:<=>:) -> oper "⇔"
          (:=>:) -> oper "⇒"
          (:<=:) -> oper "⇐"
          (:&:) -> oper "∧"
          (:|:) -> oper "∨"
          (:~&:) -> oper "NAND"
          (:~|:) -> oper "NOR"
          (:<~>:) -> oper "XOR"
    • Relevant bindings include
        pretty :: BinOp
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at Codec/TPTP/Pretty.hs:155:5)
    |
156 |         (:<=>:) -> oper "⇔"
    |                    ^^^^^^^^

/Users/sakai/src/logic-TPTP/Codec/TPTP/Pretty.hs:167:20: error:
    • Couldn't match type ‘ann’
                     with ‘prettyprinter-ansi-terminal-1.1.3:Prettyprinter.Render.Terminal.Internal.AnsiStyle’
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      ‘ann’ is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    InfixPred -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at Codec/TPTP/Pretty.hs:166:5-10
    • In the expression: oper "="
      In a case alternative: (:=:) -> oper "="
      In the expression:
        case x of
          (:=:) -> oper "="
          (:!=:) -> oper "≠"
    • Relevant bindings include
        pretty :: InfixPred
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at Codec/TPTP/Pretty.hs:166:5)
    |
167 |         (:=:)   -> oper "="
    |                    ^^^^^^^^

/Users/sakai/src/logic-TPTP/Codec/TPTP/Pretty.hs:174:30: error:
    • Couldn't match type ‘ann’
                     with ‘prettyprinter-ansi-terminal-1.1.3:Prettyprinter.Render.Terminal.Internal.AnsiStyle’
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      ‘ann’ is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    WithEnclosing (Term0 t)
                    -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at Codec/TPTP/Pretty.hs:171:5-10
    • In the expression: prational d
      In a case alternative: NumberLitTerm d -> prational d
      In the expression:
        case x of
          Var s -> pretty s
          NumberLitTerm d -> prational d
          DistinctObjectTerm s -> cyan (dquotes (text s))
          FunApp f [] -> fsym f
          FunApp f args
            -> fsym f <> prettyargs (fmap (WithEnclosing EnclNothing) args)
    • Relevant bindings include
        pretty :: WithEnclosing (Term0 t)
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at Codec/TPTP/Pretty.hs:171:5)
    |
174 |           NumberLitTerm d -> prational d
    |                              ^^^^^^^^^^^

/Users/sakai/src/logic-TPTP/Codec/TPTP/Pretty.hs:207:28: error:
    • Couldn't match type ‘ann’
                     with ‘prettyprinter-ansi-terminal-1.1.3:Prettyprinter.Render.Terminal.Internal.AnsiStyle’
      Expected: Doc -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc -> Doc
      ‘ann’ is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    Annotations -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at Codec/TPTP/Pretty.hs:207:5-10
    • In the first argument of ‘(.)’, namely ‘dullwhite’
      In the first argument of ‘($)’, namely ‘dullwhite . text’
      In the expression: dullwhite . text $ "NoAnnotations"
    • Relevant bindings include
        pretty :: Annotations
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at Codec/TPTP/Pretty.hs:207:5)
    |
207 |     pretty NoAnnotations = dullwhite . text $ "NoAnnotations"
    |                            ^^^^^^^^^

/Users/sakai/src/logic-TPTP/Codec/TPTP/Pretty.hs:211:27: error:
    • Couldn't match type ‘ann’
                     with ‘prettyprinter-ansi-terminal-1.1.3:Prettyprinter.Render.Terminal.Internal.AnsiStyle’
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      ‘ann’ is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    UsefulInfo -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at Codec/TPTP/Pretty.hs:211:5-10
    • In the expression: empty
      In an equation for ‘pretty’: pretty NoUsefulInfo = empty
      In the instance declaration for ‘Pretty UsefulInfo’
    • Relevant bindings include
        pretty :: UsefulInfo
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at Codec/TPTP/Pretty.hs:211:5)
    |
211 |     pretty NoUsefulInfo = empty
    |                           ^^^^^

/Users/sakai/src/logic-TPTP/Codec/TPTP/Pretty.hs:218:26: error:
    • Couldn't match type ‘ann’
                     with ‘prettyprinter-ansi-terminal-1.1.3:Prettyprinter.Render.Terminal.Internal.AnsiStyle’
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      ‘ann’ is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    GData -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at Codec/TPTP/Pretty.hs:217:5-10
    • In the expression: prational x
      In an equation for ‘pretty’: pretty (GNumber x) = prational x
      In the instance declaration for ‘Pretty GData’
    • Relevant bindings include
        pretty :: GData
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at Codec/TPTP/Pretty.hs:217:5)
    |
218 |     pretty (GNumber x) = prational x
    |                          ^^^^^^^^^^^

/Users/sakai/src/logic-TPTP/Codec/TPTP/Pretty.hs:227:29: error:
    • Couldn't match type ‘ann’
                     with ‘prettyprinter-ansi-terminal-1.1.3:Prettyprinter.Render.Terminal.Internal.AnsiStyle’
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      ‘ann’ is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    AtomicWord -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at Codec/TPTP/Pretty.hs:227:5-10
    • In the expression:
        (if isLowerWord x then text else squotes . text) x
      In an equation for ‘pretty’:
          pretty (AtomicWord x)
            = (if isLowerWord x then text else squotes . text) x
      In the instance declaration for ‘Pretty AtomicWord’
    • Relevant bindings include
        pretty :: AtomicWord
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at Codec/TPTP/Pretty.hs:227:5)
    |
227 |     pretty (AtomicWord x) = (if isLowerWord x then text else squotes.text) x
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

/Users/sakai/src/logic-TPTP/Codec/TPTP/Pretty.hs:231:29: error:
    • Couldn't match type ‘ann’
                     with ‘prettyprinter-ansi-terminal-1.1.3:Prettyprinter.Render.Terminal.Internal.AnsiStyle’
      Expected: prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc
      ‘ann’ is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    GTerm -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at Codec/TPTP/Pretty.hs:230:5-10
    • In the expression: pretty x <+> oper ":" <+> pretty y
      In an equation for ‘pretty’:
          pretty (ColonSep x y) = pretty x <+> oper ":" <+> pretty y
      In the instance declaration for ‘Pretty GTerm’
    • Relevant bindings include
        pretty :: GTerm
                  -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at Codec/TPTP/Pretty.hs:230:5)
    |
231 |     pretty (ColonSep x y) = pretty x <+> oper ":" <+> pretty y
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

/Users/sakai/src/logic-TPTP/Codec/TPTP/Pretty.hs:239:20: error:
    • Couldn't match type ‘ann’
                     with ‘prettyprinter-ansi-terminal-1.1.3:Prettyprinter.Render.Terminal.Internal.AnsiStyle’
      Expected: Doc -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        Actual: Doc -> Doc
      ‘ann’ is a rigid type variable bound by
        the type signature for:
          pretty :: forall ann.
                    V -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
        at Codec/TPTP/Pretty.hs:239:5-10
    • In the first argument of ‘(.)’, namely ‘blue’
      In the first argument of ‘($)’, namely ‘blue . text’
      In the expression: blue . text $ x
    • Relevant bindings include
        pretty :: V -> prettyprinter-1.7.1:Prettyprinter.Internal.Doc ann
          (bound at Codec/TPTP/Pretty.hs:239:5)
    |
239 |     pretty (V x) = blue . text $ x
    |                    ^^^^
msakai commented 1 year ago

I added an upper bound ansi-wl-pprint < 1.0 on all versions of logic-TPTP on Hackage.