Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 12 2021 21:36
    fcallejon edited #60
  • Oct 12 2021 21:34
    fcallejon edited #60
  • Oct 12 2021 21:33
    fcallejon opened #60
  • Oct 12 2021 21:05
  • Aug 10 2021 21:30
  • Jun 24 2021 03:00
  • Apr 06 2021 08:21
    cmeeren commented #59
  • Apr 06 2021 08:20
    cmeeren commented #59
  • Apr 06 2021 08:01
    varon commented #59
  • Apr 06 2021 06:02
    cmeeren commented #59
  • Apr 06 2021 06:01
    cmeeren commented #59
  • Apr 06 2021 02:06
    et1975 commented #59
  • Apr 05 2021 19:04
    cmeeren commented #59
  • Apr 05 2021 12:36
    varon commented #59
  • Mar 30 2021 17:23
    cmeeren opened #59
  • Jan 27 2021 14:37
    LAJW commented #58
  • Jan 27 2021 11:06
    varon commented #58
  • Jan 27 2021 09:22
    LAJW commented #58
  • Jan 26 2021 20:45
    varon commented #58
  • Jan 26 2021 20:44
    varon commented #58
Maxime Mangel
@MangelMaxime
Oh cool :) I will give it a try. Is the new version the one on Github ? (Now that I know how to compile fable :) ) @alfonsogarciacaro
Andrew Cherry
@kolektiv
@alfonsogarciacaro - that's very cool! I actually think Aether will be very useful for people wanting to work with client side models and "single state object" approaches - it's awesome that you've made it work :)
Alfonso Garcia-Caro
@alfonsogarciacaro
Yeah, resolving the operator overload it's been a bit tricky because the F# AST gives you less information for inline calls resolved at compile time (named trait calls) than for normal method calls. But I agree that Aether can be very useful for Fable programs and it's also been a great exercise to improve Fable interpretation of the F# AST :+1:
@MangelMaxime, I'll probably merge it today but for now the fix is in the flatten-lambdas branch.
Maxime Mangel
@MangelMaxime
Ok thanks for the information
Alojzy Leszcz
@bratfizyk
Heya - I've been playing with Chiron and noticed something interesting:
I've got a function:
        let inline serialise (x : 'a) = 
            (Chiron.Mapping.Json.serialize >> Chiron.Formatting.Json.format) x
In general - it works fine, however:
serialise ()
Causes compiler to complain - no "To/From Json"
Alojzy Leszcz
@bratfizyk
Because of that can't use my higher-order function in a few cases. That's definitely not a major problem, but is there anything that could be done about it in a nice way ?
Alojzy Leszcz
@bratfizyk
Update:
I've worked out that a fix would need to be applied to Chiron lib directly. E.g.
    type ToJsonDefaults = ToJsonDefaults with

        static member inline ToJson (x: unit) =
            Json.Optic.set Json.Null_ x
Background: I've been working on my own OWIN extension like this:
app.UseStaticFiles(staticConfig)
                   .UseChironProcessor(Post "/api/myEndpoint", api.myEndpointHandler)
app is of type IAppBuilder
in general the handler function is of type: 'a -> 'b, but all the in params are sent as strings and then parsed to 'a using Chiron
however, sometimes 'a is just unit - there are functions in my api that don't require any parameter (e.g. return all the records in an associated db)
and that's the problem
Andrew Cherry
@kolektiv
oh, yes i see what you mean there. hmmm. i'll have a quick look and see if there's a neat way to stick that in (and for FromJson too).
i don't see why not.
Andrew Cherry
@kolektiv
@bratfizyk so, i just pushed out a pre-release of Chiron with a change to support that, if you want to try it. take a dependency on Chiron 6.3.0-rc1 and see whether that works for you :)
Alojzy Leszcz
@bratfizyk
@kolektiv Cool - let me take a look.
Alojzy Leszcz
@bratfizyk
ok - so here's what I found out
My "UseChironProcessor" endpoint now compiles for functions like: unit -> 'a, but the problem is that for "kick" this endpoint, I need to put "null" in GET/POST body.
Ideally I'd like it to work with an empty body, but that would require Chiron to interpret an empty string as a unit value.
Not sure if it's potentially dangerous - what do you think about it ?
Andrew Cherry
@kolektiv
mmmm. have you considered having an optional body type? So Option<Json> or similar? that might make things easier, as any empty body would simply become None - and that maps closer to the semantics of HTTP i think...
(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: