by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 06 11:50
    landy commented #56
  • Aug 06 11:32
    et1975 commented #56
  • Aug 06 08:35
    Build #122 passed
  • Aug 06 08:35
    landy opened #56
  • Aug 05 21:18
  • May 12 18:46
    Build #121 passed
  • May 12 18:45

    panesofglass on master

    Update README.md Adds direct i… Merge pull request #55 from njl… (compare)

  • May 12 18:45
    panesofglass closed #55
  • Mar 30 23:16
    Build #120 passed
  • Mar 30 23:16
    njlr opened #55
  • Mar 30 23:12
    njlr forked
    njlr/aether
  • 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
Andrew Cherry
@kolektiv
(happy to take a look at the source of the ChironProcessor if you like as well, might be able to offer a suggestion!)
it'll be later today though as I have to head for some meetings now, but i'm happy to take a look when i can!
Alojzy Leszcz
@bratfizyk
sure - I'll give a go to your suggestion with the optional body
now that unit values compile, life is a bit simpler
I'll keep you updated
Alojzy Leszcz
@bratfizyk
                  requestBody :=  
                        (let body = (Env.getRequestBody environment) in if String.isNullOrEmpty body then "null" else body)
works for now - hopefully won't bite me too painfully
Andrew Cherry
@kolektiv
that sounds pretty good :) i'd love to see the complete thing and how it works if you can share any of it
Alojzy Leszcz
@bratfizyk
Yeah - that's the problem. It's not my personal project, but a corporate one, so unfortunately I can't share it - sorry for that.
The fix for unit - however - has been working well so far. I'll keep on testing it next week.
Andrew Cherry
@kolektiv
that's no problem - i'm always happy when code is being used, open or not! glad the unit fix is useful, if you don't find issues i might make that final next week
Alojzy Leszcz
@bratfizyk
OK - for sure I'll let you know about my testing experience ;).
Andrew Cherry
@kolektiv
thanks! :)
Alojzy Leszcz
@bratfizyk
Now it's marked as "rc", so no rush - let's make sure it truly deserves becoming an official release ;)
all right - home time; have a good weekend !
Andrew Cherry
@kolektiv
you too!
Alojzy Leszcz
@bratfizyk
Heya - interesting stuff found today:
        let inline serialise (x : 'a) = 
            (Chiron.Mapping.Json.serialize >> Chiron.Formatting.Json.format) x
and now:
> serialise [| 1; 2 |];;
val it : string = "[1,2]"
but:
> serialise [| "1"; "2" |];;
System.TypeInitializationException: The type initializer for 'Escaping' threw an exception. ---> System.TypeInitializationException: The type initializer for '<StartupCode$Chiron>.$Chiron' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'FParsec, Version=1.0.0.0, Culture=neutral, PublicKeyToken=40ccfc0a09edbb5d' or one of its dependencies. The system cannot find the file specified.
   at <StartupCode$Chiron>.$Chiron..cctor()
   --- End of inner exception stack trace ---
   at Chiron.Escaping..cctor() in C:\projects\chiron\src\Chiron\Chiron.fs:line 0
>    --- End of inner exception stack trace ---
   at Chiron.Escaping.escape(String s)
   at Chiron.Formatting.formatJson(Int32 level, JsonFormattingOptions options, Json _arg1) in C:\projects\chiron\src\Chiron\Chiron.fs:line 704
   at Chiron.Formatting.formatArray@710-1.Invoke(Json _arg1) in C:\projects\chiron\src\Chiron\Chiron.fs:line 710
   at Chiron.Formatting.join@667-2.Invoke(StringBuilder b) in C:\projects\chiron\src\Chiron\Chiron.fs:line 670
   at Chiron.Formatting.formatArray@708-4.Invoke(StringBuilder x) in C:\projects\chiron\src\Chiron\Chiron.fs:line 708
   at Chiron.Formatting.formatArray@708-5.Invoke(StringBuilder x) in C:\projects\chiron\src\Chiron\Chiron.fs:line 708
   at Chiron.Formatting.Json.format(Json json) in C:\projects\chiron\src\Chiron\Chiron.fs:line 743
   at <StartupCode$FSI_0005>.$FSI_0005.main@()
Stopped due to error
So serialising an array of ints works fine, but doesn't work with an array of strings.
Can you try it as well ?
Andrew Cherry
@kolektiv
i'll have a look when i get a chance a little later! i'd start by seeing if i can work out why there's a file not found error for fparsec - that might well be related, but it's odd that it would be intermittent.
Alojzy Leszcz
@bratfizyk
ok - feel free to ignore this
I've just checked that after some paket-magic I had done, my project lost a reference to FParsec
After fixing that all fine
sorry for the false alarm
Andrew Cherry
@kolektiv
no problem :)
Alojzy Leszcz
@bratfizyk
Heya - about the unit feature testing: so far so good
Andrew Cherry
@kolektiv
:) sounds good!
Stefan Reichel
@stefan-akelius
This message was deleted
btrepp
@btrepp

With lenses and prisms, is there a guide in which it is appropriate to use either?. are prisms mainly for nested datastructures?. In freya the IfMatch_ header is returned as an IfMatch option Lens, rather than an IfMatch prism.

Say i wanted to deal with some nested values, it would make sense to use an epimorphism eg ifmatchweaktag_: Epimorphism<IfMatch,EntityTag.Weak>
But then with IfMatch itself being a Lens<IfMatch option> this doesn't compose.

I have written a composing epimorphism

      let private toPrism_ : Epimorphism<'T option, 'T> = (fun x -> x),
                                                            (fun v -> Some v)

but I'm not sure if this is idiomatic. I ask because I have my own lens in freya for the ClaimsPrincipal Lens<State,ClaimsPrincipal option>, which I can see the advantage for (eg my middeware could remove the claims principal if it wants to), but then most uses I can think of would want Prism<State,ClaimsPrincipal>.

varon
@varon
@btrepp Andrew will have a better answer, but from my experience, there's no harm in providing both.
Especially if you're providing a library, it can be a lot easier to work with if the lenses/prisms already exist.
Jon Schoning
@jonschoning

https://xyncro.tech/aether/guides/morphisms.html

type Epimorphism<'a,'b> = ('a -> 'b option) * ('b -> 'a)
My understanding of epi is that it is morally surjective; wouldn't a function from 'a to 'b always have to succeed/produce a value then, because surjection means that the entire codomain receives a value?

Jon Schoning
@jonschoning
i think it makes sense if we're considering the function from going from the preimage of 'a instead of the domain of 'a, then in that case there could be values in the domain of 'a that the function doesn't act on
Jon Schoning
@jonschoning
epimorphism would look more like ('a -> 'b) * ('b -> NonEmptySeq<'a>)
Alojzy Leszcz
@bratfizyk
Hi Andrew. About the Defaults for unit type - no problems from my side. Just deployed a new version of my service to my testing environment. Should be safe to remove the "rc" label (hopefully I won't regret saying that ;) ).
Andrew Cherry
@kolektiv
i haven't noticed any issues, so hopefully... :) i'll push to general release later when i get a moment!
Eugene Tolmachev
@et1975
@kolektiv Aether gets a Fable build: https://github.com/et1975/fable-aether/
hope you don't mind
varon
@varon
It's great to see Aether included in more places!
Maxime Mangel
@MangelMaxime

Hello guys :)
Is it possible to write something like that:

        let m' =
          model
          |> Optic.set (Model.Name_ >-> StringField.Value_) data.Name
          |> Optic.set Model.PatientPermissions_ data.PatientPermissions

My problem is the last line which is getting an error because Model.PatientPermissions_ don't have supported overload.
I could write it with standard record update but would look less "fluid" :)

Alojzy Leszcz
@bratfizyk
Hi guys,
The API I'm using returns one field that's an array of mixed types: sometimes it's a DateTime, sometimes it's a float. I think in order to deserialize it with Chiron I need to define a special F# type for it like:
type internal StringOrDecimal =
    | String of string
    | Decimal of decimal
But then I fail to create To/FromJson methods for the type. I've tried something like this:
    static member ToJson (x: StringOrDecimal) =
        match x with
        | String arg -> Json.String arg
        | Decimal arg -> Json.Number arg
but obviously the type of the function is incorrect. Any help with that ?
An example of the field that the API returns:
...
"data": [ [ "2016-12-04",  767.99, 750.0, 758.995, 760.519, 760.519, 760.111, 2376697.26975, 3137.22338 ] ],
...
varon
@varon
You probably want to write some dynamic type checking:
match x with
| :? string as s -> ...
| :? int as i -> ...
| _ -> ...
Alojzy Leszcz
@bratfizyk
I'm not sure - this would result in having the ToJson of type: obj -> Json<unit>. I don't think providing To/From Json for obj is a good practice.