Skip to content
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

Task: rid TypeChecking.Pretty of UndecidableInstances #1300

Open
GoogleCodeExporter opened this issue Aug 8, 2015 · 0 comments
Open

Task: rid TypeChecking.Pretty of UndecidableInstances #1300

GoogleCodeExporter opened this issue Aug 8, 2015 · 0 comments
Labels
difficulty: easy Supposedly easy to fix. type: task Concerning the development of Agda (not in changelog)
Milestone

Comments

@GoogleCodeExporter
Copy link

GoogleCodeExporter commented Aug 8, 2015

See Agda.TypeChecking.Pretty:

{-# LANGUAGE UndecidableInstances #-}

instance (Reify a e, ToConcrete e c, P.Pretty c) => PrettyTCM (Named_ a) where
    prettyTCM x = prettyA =<< reify x

instance (Reify a e, ToConcrete e c, P.Pretty c) => PrettyTCM (Arg a) where
    prettyTCM x = prettyA =<< reify x

instance (Reify a e, ToConcrete e c, P.Pretty c) => PrettyTCM (Dom a) where
    prettyTCM x = prettyA =<< reify x

The PrettyTCM instances for Named_, Arg, and Dom should be defined in terms of
PrettyTCM a, not Reify a.

How to implement this?

Write functions that put the information contained in Named_ / Arg_/ Dom onto a
Doc, like

  prettyArg :: Arg Doc -> Doc

and then just define

  prettyTCM arg = prettyArg <$> prettyTCM (unArg arg)

Similar functionality can be found in Syntax.Concrete.Pretty:

pHidden :: Pretty a => ArgInfo -> a -> Doc
pHidden i = bracks h . pretty
  where bracks Hidden   = braces'
        bracks Instance = dbraces
        bracks NotHidden= id
        h = argInfoHiding i

pRelevance :: Pretty a => ArgInfo -> a -> Doc
pRelevance i a =
  let d = pretty a
  in  if render d == "_" then d else pretty (argInfoRelevance i) <> d

Original issue reported on code.google.com by andreas....@gmail.com on 9 Oct 2014 at 10:19

@asr asr added type: task Concerning the development of Agda (not in changelog) and removed Type-Task labels Aug 16, 2015
@UlfNorell UlfNorell added this to the icebox milestone May 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: easy Supposedly easy to fix. type: task Concerning the development of Agda (not in changelog)
Projects
None yet
Development

No branches or pull requests

3 participants