Hacker News new | ask | show | jobs
by jorkadeen 337 days ago
But in Flix you can write:

  def main(): Unit \ IO = 
      Map.empty() |>
      Map.insert("Hello", "World") |>
      Map.get("Hello") |>
      println
So I am not sure what you mean? In general, if you like pipelines then you want the "subject" (here the map) to be the last argument. That is how it is in Flix.
1 comments

Sorry, I wasn't clear. Yes, you can have pipelines in Flix, F#, OCaml, to me however placing the "subject" first feels more natural, as function signatures (not necessarily in pipelines) have a symmetry not encountered otherwise:

Subject First:

  Map.put(map, key, value)
  Map.get(map, key)
  Map.get(map, key, default)
  Map.del(map, key)
Subject Last:

  Map.put(key, value, map)
  Map.get(key, map)
  Map.get(key, default, map)
  Map.del(key, map)