Skip to content

Could there be a conflict with generic-lens-labels and similar libraries? #8

@Wizek

Description

@Wizek

Hey, I'm just now getting to know this library. I have been waiting/looking for a nice implementation for named parameters for Haskell for a long time, so I am glad you've created this, and I'm glad to have found it.

However, seeing labels being used as functions gives me some pause. Could this library conflict with https://github.com/duog/generic-lens-labels? According to my admittedly fuzzy and likely spotty understanding, both of these libraries define orphan instances for IsLabel (-> _), don't they? Meaning that only one of these can be used in a Haskell module (or perhaps even package?) at once, and never together, doesn't it? And if so far I am on the mark here, this mutual exclusion extends to any other libraries that define similar instances, doesn't it?

So if I'm correct above, could one relatively nice way of overcoming this issue be defining an operator that takes the being-a-function-burden off of IsLabel's shoulder?

createSymLink :: "from" % FilePath -> "to" % FilePath  -> IO ()
createSymLink (Named from) (Named to) = ...

main = createSymLink ! #from =: "/path/to/source"
                     ! #to   =: "/target/path"

E.g. above I've used =:, but could be a different one as well.
(I also wonder if the type level operator % can be re-defined on the value level as well.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions