Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 24 21:40
  • Jan 06 02:38
  • Dec 15 2019 20:06
    Mateiadrielrafael closed #54
  • Dec 15 2019 20:06
    Mateiadrielrafael commented #54
  • Dec 14 2019 16:30
    varon commented #54
  • Dec 08 2019 19:50
    Mateiadrielrafael opened #54
  • Nov 23 2019 12:00
    njlr edited #53
  • Nov 22 2019 23:41
    njlr opened #53
  • Nov 14 2019 15:39
    stroborobo closed #52
  • Nov 14 2019 15:39
    stroborobo commented #52
  • Sep 14 2019 03:59
  • Mar 29 2019 20:09
    et1975 commented #52
  • Mar 29 2019 14:54
    panesofglass commented #52
  • Mar 29 2019 12:21
    stroborobo commented #52
  • Mar 29 2019 12:17
    et1975 commented #52
  • Mar 29 2019 11:44
    stroborobo commented #52
  • Mar 29 2019 10:44
    Build #119 passed
  • Mar 29 2019 10:44
    stroborobo edited #52
  • Mar 29 2019 10:43
    stroborobo opened #52
  • Mar 29 2019 10:35
varon
@varon
@kolektiv - xyncro/aether#47
Wojtek
@wklm
Hey Everyone :)
Could someone suggest a good example for working with nested jsons with chiron?
varon
@varon
@wklm - this is the aether channel. try the chiron one.
Wojtek
@wklm
@varon sorry, I chiron docs are pointing here
varon
@varon
no worries, probably needs a PR to fix that link
Wojtek
@wklm
:+1:
btrepp
@btrepp
So my first intro to lenses was aether, and I'm not too around the theory, but we have prism defined as Prism<'a,'b>: ('a->'b option),('a->'b->'a). I can somewhat intuit that, but sometimes I feel like I want to reach for something of the form Prism<'a,'b>: ('a-> Result<'b,string>),('a->'b->'a)
With the idea that the Prism ultimatelty tells us which part in the tree is missing
So when one goes Optic.get lens data we get Result<'a,string> with an error message about why the lens failed. (Which would be handy in logging)
Am I insane/missing the point?
Pete Johanson
@petejohanson
Shouldn't be too hard to write a function to compose prisms/lenses that way.
What are you trying to achieve by discovering where the None started in the chain?
May be slightly nicer to have the TError be a string list instead, that gets the chain appended too.
btrepp
@btrepp
Usually I've been using aether + chiron together. To parse into my own datastructures, it would be nice to debug how and why a lense failed to get a value
At the moment I find myself writing a would bunch of Result<'a,'b> code after I get specific parts of objects
giuliohome
@giuliohome
morning, I have a |> List.mapi on a list of a record type
If I want to assign (change) a member in the mapi fun, should I use a lens ?
Pete Johanson
@petejohanson
You certainly could. A lens will be more helpful if you're trying to change something ' in the record.
deeper'
giuliohome
@giuliohome
oh... deeper... you right
in this case maybe I just need record overload syntax thank you
Pete Johanson
@petejohanson
Yeah, also depends if you've already got lenses for your types defined, might as well use them.
Justin Rawlings
@jmjrawlings
Apologies if this has been asked before, but is there a way to use lenses to map between generic types? Something like this:
open Aether

let a : int option = Some 3

// This does not compile
let b : string option =
    a
    |> Optic.map Option.value_ string
varon
@varon
@jmjrawlings - This is a super late answer but...
Just map over the containing type.
a |> Option.map string
you don't need lenses in that case.
If you wanted to do it with lenses:
        let a : int option = Some 3

        let b : string option =
            a |> Optic.map string Option.value_
sashang
@sashang
Hi - how do I use chiron to query values from json data?
sorry wrong room
Torben Clasen
@Angr1st
If I have multiple Values inside of my Record that I want to use Optics to update. Could anyone be so kind to whip up a short example?