Code Monkey home page Code Monkey logo

Comments (10)

ivan-m avatar ivan-m commented on August 9, 2024

Yeah, I'm not a big fan of using RULES for this, but I'm hesitant to move these functions to the classes whilst for the most part development on fgl is progressing in an improvement fashion (adding docs, adding useful functions, etc.) that are mainly backwards compatible; changing the typeclass definitions is more of a major version change.

from fgl.

treeowl avatar treeowl commented on August 9, 2024

It's possible to make the change in a way that's invisible to users,
although it can be made visible later. See, for example,
Data.Profunctor.Unsafe, which defines the Profunctor class including some
methods not exposed through Data.Profunctor. The default definitions ensure
that even users importing only Data.Profunctor can write valid (if perhaps
somewhat inefficient) instances. I believe the public module can just
import the methods as functions.

import Secret (Graph(.....), gmap, ....)

There are some other ideas I have that would be more major-versiony than
this. I'd love to get more specific about some types, turn some tuples into
records, make some things stricter, and make it easier to ensure that code
doesn't accidentally rely on Node=Int.

On Aug 29, 2016 9:52 PM, "Ivan Lazar Miljenovic" [email protected]
wrote:

Yeah, I'm not a big fan of using RULES for this, but I'm hesitant to move
these functions to the classes whilst for the most part development on fgl
is progressing in an improvement fashion (adding docs, adding useful
functions, etc.) that are mainly backwards compatible; changing the
typeclass definitions is more of a major version change.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#38 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABzi_a43M6FM-FJMQ7_2ogBpSFs12W28ks5qk4zxgaJpZM4JwDbm
.

from fgl.

treeowl avatar treeowl commented on August 9, 2024

Oh yes, and quit that horrible "Check for empty, then use a partial
function to decompose" pattern.

On Aug 29, 2016 10:05 PM, "David Feuer" [email protected] wrote:

It's possible to make the change in a way that's invisible to users,
although it can be made visible later. See, for example,
Data.Profunctor.Unsafe, which defines the Profunctor class including some
methods not exposed through Data.Profunctor. The default definitions ensure
that even users importing only Data.Profunctor can write valid (if perhaps
somewhat inefficient) instances. I believe the public module can just
import the methods as functions.

import Secret (Graph(.....), gmap, ....)

There are some other ideas I have that would be more major-versiony than
this. I'd love to get more specific about some types, turn some tuples into
records, make some things stricter, and make it easier to ensure that code
doesn't accidentally rely on Node=Int.

On Aug 29, 2016 9:52 PM, "Ivan Lazar Miljenovic" [email protected]
wrote:

Yeah, I'm not a big fan of using RULES for this, but I'm hesitant to
move these functions to the classes whilst for the most part development on
fgl is progressing in an improvement fashion (adding docs, adding useful
functions, etc.) that are mainly backwards compatible; changing the
typeclass definitions is more of a major version change.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#38 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABzi_a43M6FM-FJMQ7_2ogBpSFs12W28ks5qk4zxgaJpZM4JwDbm
.

from fgl.

ivan-m avatar ivan-m commented on August 9, 2024

Well, the latter will definitely require a major version bump ;-)

In reality, I'd like to have the time to write a new graph library from the ground up... but I've been saying that for about 10 years now >_>

What makes expanding the class major version bump required is from how you have to import functions; this is classified as a breaking change by the Package Versioning Policy.

from fgl.

treeowl avatar treeowl commented on August 9, 2024

It's definitely possible to avoid that. At worst, you can use

module Public where
import qualified Secret
gmap :: ...
gmap = Secret.gmap

but I don't think you have to go that far. I believe that having the
public module import or export the methods outside the parentheses will
turn the methods into functions to the outside.

On Aug 29, 2016 10:11 PM, "Ivan Lazar Miljenovic" [email protected]
wrote:

Well, the latter will definitely require a major version bump ;-)

In reality, I'd like to have the time to write a new graph library from
the ground up... but I've been saying that for about 10 years now >_>

What makes expanding the class major version bump required is from how you
have to import functions; this is classified as a breaking change
http://pvp.haskell.org/ by the Package Versioning Policy.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#38 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABzi_cPTg6pQHT3wvtS1YH-B3Ir6MvW3ks5qk5FqgaJpZM4JwDbm
.

from fgl.

treeowl avatar treeowl commented on August 9, 2024

Ugh. I just checked. The easy ways don't work, as you expected (silly
design decision that). But the ugly sledgehammer of writing functions
implemented using secret methods works just fine.

On Mon, Aug 29, 2016 at 10:19 PM, David Feuer [email protected] wrote:

It's definitely possible to avoid that. At worst, you can use

module Public where
import qualified Secret
gmap :: ...
gmap = Secret.gmap

but I don't think you have to go that far. I believe that having the
public module import or export the methods outside the parentheses will
turn the methods into functions to the outside.

On Aug 29, 2016 10:11 PM, "Ivan Lazar Miljenovic" <
[email protected]> wrote:

Well, the latter will definitely require a major version bump ;-)

In reality, I'd like to have the time to write a new graph library from
the ground up... but I've been saying that for about 10 years now >_>

What makes expanding the class major version bump required is from how
you have to import functions; this is classified as a breaking change
http://pvp.haskell.org/ by the Package Versioning Policy.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#38 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABzi_cPTg6pQHT3wvtS1YH-B3Ir6MvW3ks5qk5FqgaJpZM4JwDbm
.

from fgl.

ivan-m avatar ivan-m commented on August 9, 2024

Actually, I think the best solution for this would be Backpack if/when it becomes usable. But back in the real world...

I suppose my main concern about this kind of hidden class change is that on the off chance someone else is implementing their own instances of Graph and DynGraph then this will result in having to update their code twice: once to use the new hidden version, then again when it's made public.

from fgl.

treeowl avatar treeowl commented on August 9, 2024

They absolutely do not need to update their code the first time. Their code
will continue to do exactly what it was doing before; the method will
simply take its default definition, which will be the same as the
definition of what is now a function.

On Mon, Aug 29, 2016 at 11:57 PM, Ivan Lazar Miljenovic <
[email protected]> wrote:

Actually, I think the best solution for this would be Backpack
https://ghc.haskell.org/trac/ghc/wiki/Backpack if/when it becomes
usable. But back in the real world...

I suppose my main concern about this kind of hidden class change is that
on the off chance someone else is implementing their own instances of
Graph and DynGraph then this will result in having to update their code
twice: once to use the new hidden version, then again when it's made
public.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#38 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABzi_Vq6VYHg6rHaQ-RBqf38X98-znd8ks5qk6pFgaJpZM4JwDbm
.

from fgl.

ivan-m avatar ivan-m commented on August 9, 2024

To clarify: if they want to take advantage of the new classes to not have to use their own RULEs then they'd need to update twice.

And it still breaks the PVP, so I'm not sure whether it could potentially have other impacts.

I have no problem with the next version being a major version bump with this in there, though planning around exactly where the border between being in the class and being a derived function will need to be determined.

from fgl.

ivan-m avatar ivan-m commented on August 9, 2024

(I suppose if nothing else updating FGL to have a larger type class gives me something to do at ICFP :p)

from fgl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.