Skip to content
This repository has been archived by the owner on Oct 16, 2022. It is now read-only.

"instance HasModLogger a => HasLogFunc a" overlaps on bare LogFunc #15

Closed
akhra opened this issue Jul 12, 2018 · 5 comments
Closed

"instance HasModLogger a => HasLogFunc a" overlaps on bare LogFunc #15

akhra opened this issue Jul 12, 2018 · 5 comments

Comments

@akhra
Copy link
Contributor

akhra commented Jul 12, 2018

    • Overlapping instances for HasLogFunc ModLogger
        arising from a use of ‘logFuncL’
      Matching instances:
        instance Has ModLogger α => HasLogFunc α
          -- Defined at /home/tejon/magicbane/library/Magicbane/Logging.hs:17:10
        instance HasLogFunc LogFunc
          -- Defined in ‘rio-0.1.3.0:RIO.Prelude.Logger’

I tried fixing this via Data.Type.Equality:

instance ((α == ModLogger) ~ 'False, Has ModLogger α) ⇒ HasLogFunc α where
  logFuncL = hasLens

But this doesn't work for reasons I haven't yet grasped. There's a procedural workaround described on Stack Overflow by @treeowl; I didn't immediately grok how to adapt it, and in any case it involves an additional class and newtype so I'd want your feedback on module style (per #12) before doing something like that.

@valpackett
Copy link
Owner

How is this happening? Where is the bare LogFunc coming from? Are you trying to use a bare LogFunc as the context?

@akhra
Copy link
Contributor Author

akhra commented Jul 12, 2018

Yes, while trying to test some logging stuff in isolation. And I intended to mention (whoops) that it was trivially worked around by using (LogFunc, ()) as the environment instead, so it's in no way a critical issue. But still a surprising error, and one I probably couldn't have sidestepped so quickly a year ago.

@valpackett
Copy link
Owner

Heh, what was surprising to me was using a bare LogFunc, since only tuples were intended / are mentioned in the readme :)

@akhra
Copy link
Contributor Author

akhra commented Jul 12, 2018

Unfortunately there is no standard unary tuple. ;)

@akhra
Copy link
Contributor Author

akhra commented Jul 21, 2018

Looks like the reason I couldn't find a nice constraint-based solution was because instead we got a nice compiler-based one!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants