0 Followers
0 Following
1 Posts
I’ve already got a +10 chalice this way. But this was a long time ago.
If you want something more detailed, there is a library which does the same things (with more documentation inside :)) : github.com/anuragsoni/routes
GitHub - anuragsoni/routes: typed bidirectional router for OCaml/ReasonML web applications

typed bidirectional router for OCaml/ReasonML web applications - GitHub - anuragsoni/routes: typed bidirectional router for OCaml/ReasonML web applications

GitHub

I’ve tried something recently in a project with Dream.

Suppose you have an url like /page/param1/param2/ : you want to be able to do three things:

  • Build this url in the application in a safe way, which mean : param1 -> param2 -> string
  • Create a route which handle this url pattern (the compilation should fail if you don’t handle all the arguments)
  • Ensure the handler will have the signature param1 -> param2 -> Dream.handler
  • Of course, some pages will have two arguments, some other three, and you have to find a way represent this in the type system.

    For this, I’ve used a gadt:

    type ('a, 'b) t = | Static : string * ('a, 'b) t -> (unit -> 'a, 'b) t | Int : string * ('a, 'b) t -> (int64 -> 'a, 'b) t | String : string * ('a, 'b) t -> (string -> 'a, 'b) t | End : ('a, 'a) t

    The string is the parameter name in the url (id, login, …) and the gadt make the representation for this parameter in the type system. This gives me a way to declare some urls in the application:

    val root : (unit -> 'a, 'a) t (** The path to root / *) val topic_url : (string -> 'a, 'a) t (** The path to /:topic *) val thread_url : (string -> int64 -> 'a, 'a) t (** The path to /:topic/:thread *)

    Then I have some some functions wihch handle this gadt:

    val repr : (unit -> ('a, 'b) t) -> string (** Represent the route associated with this path *) val unzip : (unit -> ('a, 'b) t) -> (string -> string) -> 'a -> 'b (** Extract the parameters from the request. [unzip path extract f] will apply the function extract for all the arguments in the path, and gives them to f The function [extract] is given in argument in order to break dependency circle. This should be something like: let extract_param request name = Dream.param request name |> Dream.from_percent_encoded *)
    Dream — Tidy, feature-complete web framework

    Tidy, feature-complete web framework

    J’allais le proposer ! Les mises a jours sont fréquentes et le jeu est très riche.

    Mon seul regret est la gestion de la difficultés, qui se fait en appliquant des coefficients de plus en plus penalisants. Je trouve que ca ne permet pas de réfléchir aux différentes stratégies dans chaque parties, ca donne plutôt le sentiment d’avoir “une” stratégie gagnante, qui oblige a suivre un chemin de plus en étroit quand on monte en difficulté

    Je ne comprend pas les axes :

    • nombre de brasserie
    • nombre de brasserie par habitants

    Cela aurait fait sens si le deuxième axes indiquait le nombre d’habitants, mais là, je n’arrive pas a me représenter la diagonale du graphique

  • Passer par un vpn (et ne pas aller vers ceux qui financent les youtubeurs)
  • Utiliser un client BitTorrent qui va n’utiliser que le vpn et s’arrêter si le vpn est coupé
  • Sinon !lemmy.world/c/piracy est une bonne source

    piracy - Lemmy.world

    I’ve made something very close, which create a mapping following the window name (windows/xlib)

    git.chimrod.com/smartcropad.git/about/

    I’ve made it for circuit python, and it works with a serial connexion / JSON messages. (It could be updated with raw USB )

    Not yet finished, but already used daily.

    smartcropad.git - Smart macropad companion

    Pour ceux qui suivent les flus européenns sur reddit/lemmy qu’est ce que ca donne comme réaction ?

    Je suis bien d’accord, disais ca dans le sens ou quel que soit le prix que l’on est prêt a mettre, ca vaudra toujours moins cher que ce qu’il nous apporte !

    C’est juste inestimable un bon lit !

    I’m using passwordstore + self hosted git server.

    Passwordstore uses gpg for the encryption layer which combine fine with ssh (used to connect to the private repo).

    I’m using qtpass as gui and there is also a client for Android named password store