Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:17

    julien-truffaut on gh-pages

    Deploy website Deploy website … (compare)

  • 15:11

    cquiroz on master

    Update sbt-scalafmt to 2.4.5 Merge pull request #1236 from s… (compare)

  • 15:11
    cquiroz closed #1236
  • 04:35
    scala-steward opened #1236
  • Dec 03 12:27

    julien-truffaut on gh-pages

    Deploy website Deploy website … (compare)

  • Dec 03 12:22

    xuwei-k on master

    Update index.js (#1234) * Upda… (compare)

  • Dec 03 12:22
    xuwei-k closed #1234
  • Dec 03 12:22
    xuwei-k closed #1229
  • Dec 03 12:15
    xuwei-k auto_merge_enabled #1234
  • Dec 03 12:15
    xuwei-k synchronize #1234
  • Dec 03 12:15
    xuwei-k synchronize #1234
  • Dec 03 11:59

    julien-truffaut on gh-pages

    Deploy website Deploy website … (compare)

  • Dec 03 11:53

    cquiroz on master

    Update scalafmt-core to 3.2.1 Merge pull request #1235 from s… (compare)

  • Dec 03 11:53
    cquiroz closed #1235
  • Dec 03 09:05
    scala-steward closed #1233
  • Dec 03 09:05
    scala-steward commented #1233
  • Dec 03 09:05
    scala-steward opened #1235
  • Dec 01 19:43
    justjoheinz opened #1234
  • Dec 01 18:12
    julien-truffaut commented #1229
  • Dec 01 17:48
    scala-steward synchronize #1233
bblfish
@bblfish:matrix.org
[m]
Ah! I saw some stackexchange questions which said that that was not there. Found it.
bblfish
@bblfish:matrix.org
[m]
I am not sure Plated is what I was looking for. I was looking for a way to locate a node in a Tree by a path, so that I could see what was there or change it.
Gabriel Volpe
@gvolpe:matrix.org
[m]
Maybe that's just Traversal ? bblfish
bblfish
@bblfish:matrix.org
[m]

going by the doc on traversal

A Traversal is the generalisation of an Optional to several targets. In other word, a Traversal allows to focus from a type S into 0 to n values of type A.

I guess that the usual path to an element is defined statically in the Monocle Lenses, whereas what is needed here is a path that is specified at run time.
Ken Scambler
@kenbot
Indexes let you do that. Looking at the Resource/Container structure that you/Henry Story submitted, you should be able to define given Index instances for your types, then do something like root.focus(_.index("www").index("foo").index("com").index("index.html").content).get
bblfish
@bblfish:matrix.org
[m]
sh ok, so I should be able to fold on a list to create such an index.
I'll try that.
Ken Scambler
@kenbot
You need to suck in a typeclass instance for each index call, so folding on a list of strings might not work in a straightforward way
bblfish
@bblfish:matrix.org
[m]

I think all I need is a way to be able to pick leaves of a

type Tree[+A] = Free[Map[String,_], A]

by the path to it's leaves... (need to think if that is the right datastructure first)

bblfish
@bblfish:matrix.org
[m]

:point_up: Edit: I think all I need is a way to be able to pick leaves of a

type Indexed[R] = Map[String,R]
type DirTree[A] =  Free[Indexed, A]

by the path to it's leaves... (need to think if that is the right datastructure first)

bblfish
@bblfish:matrix.org
[m]
No, I don't think that works...
Julien Truffaut
@julien-truffaut
Monocle 3.1.0 is released with a new refocus operation and better compatibility with cats.
bblfish
@bblfish:matrix.org
[m]
not on maven central yet though https://repo1.maven.org/maven2/dev/optics/
Ken Scambler
@kenbot
Hey @bblfish:matrix.org, could you maybe write some "fantasy code" showing what you're trying to do, if you could magic the right functionality into existence?
bblfish
@bblfish:matrix.org
[m]
I think I have something that works. I'll put it on github, and send a link here.
I was really here trying to use Monocle as a tool to quickly get an idea of how a web server could be seen as a Lens, more for theoretical purposes. (to understand what GET, PUT, POST, etc... are).
bblfish
@bblfish:matrix.org
[m]
@kenbot: I wrote together a little "web server" using lenses :-)
https://github.com/bblfish/lens-play/blob/master/src/main/scala/server/Server.scala
definitely very fantasy :-)
I have a feeling that the recent work on the category of polynomials allows one to think of actor systems as generalised lenses.... But I have no confirmation of that yet, and it's a lot of work to work out.
bblfish
@bblfish:matrix.org
[m]
But you will see there that I had to use Index to take a list to find the right element to replace in the web server.
bblfish
@bblfish:matrix.org
[m]
For a bit of context see web-cats/CG#28
Julien Truffaut
@julien-truffaut
There is a Monocle chanel in the typelevel discord server. We'll most likely phase out gitter over the next few weeks: https://discord.com/invite/XF3CXcMzqD
Ken Scambler
@kenbot
I've given you some detailed feedback over on Typelevel discord, @bblfish:matrix.org