HNHacker News
TopNewBestAskShowJobs

agocorona

54 karma · joined November 5, 2014

submissionscomments
agocorona··on If Haskell is so great, why hasn't it taken over the world? (2017)
There is already a kind of unison for Haskell:

https://github.com/transient-haskell/transient

agocorona··on 60+ Existing Workflow Systems
This one too: https://github.com/agocorona/Workflow
agocorona··on Show HN: A Haskell library for web and distributed composable applications
Since JavaScript and the browser is the only thing that matters nowadays:

transient-universe can run Browser nodes compiled from haskell to Javascript. they can display DOM widgets and are integrated with server nodes, using websockets communications. Just compile the program with the Haskelll to JS compiler and point the browser to http://server:port. The server nodes have a HTTP server that will send the compiled program to the browser.

agocorona··on Show HN: A Haskell library for web and distributed composable applications
Haxl is a great Haskell library and probably the biggest contribution to getting Haskell out of the academia. It is optimized for fetching querying and caching data sources, among other things, making use of parallelism and concurrency while maintaining a level close to the domain problem.

Haxl uses a controlling thread that spawn worker threads and is single purpose. No distributed computing in the strong sense.

transient has no controlling thread. It run multiple threads and is general purpose.

The alternative operator <|> can spawn parallel threads/or parallel distributed computations that follow the flow of the monad. for example:

    r <-   runAt node1 foo <|>  runAt node2 bar
    lliftIO $ print r
will print two results, since there are two thread generated. Well there may be any number of results because any of the two branches may generate multiple threads or none, since they can stop without any result.

(if we need a single thread, we can use `collect`)

note that `foo` and `bar` are distributed programs as well, so they can invoke other nodes and so on.

agocorona··on Show HN: A Haskell library for web and distributed composable applications
Good question. The actor model communicate via mailboxes, which execute callbacks sort to say. Essentially this produces the callback hell.

Taking away the initializations, this is the ping pong example in Erlang:

https://gist.github.com/torgeir/3978785

    ping(Receiver) ->
      { pong, Receiver } ! { ping, self() },
      receive
        pong -> io:format("Got pong!~n")
    end.

    pong() ->
      receive

        finished ->
          io:format("Pong finished~n");

        { ping, Sender } ->
          io:format("Got ping!~n"),
          Sender ! pong,
          pong()
      end.


This is the same in Transient: A message is sent to the receiver print "ping" in his console, then send a message to the sender, that print "pong" in his console

    pingPong receiver=  
      wormhole receiver $ do
          teleport
          lliftIO $ print "ping"
          teleport
          lliftIO $ print "pong"
You see that the ping and the pong are composed "monadically" in a single piece of code. The flow is quite understandable.

Just start the program in both nodes (initialization code is not shown)

This is a distributed program but I can compose this program with any other.

This other program stream integers from a remote node from 1 in increasing order:

    streamFrom node= 
       wormhole  node $ do
                  teleport
                  r <- threads 1 $ choose[1..]
                  threadDelay 1000000
                  teleport
                  return r
I can compose both distributed programs:

    composed node =  do
         r <-  (pingPong node >> return 0) <|>  streamFrom node
         lliftIO $ case r of
              0 -> putStrLn "pong was received"
              n -> print n
`composed` print the numbers received and the "pong" messages followed by "pong was received" in the console of the caller.
agocorona··on Show HN: A Haskell library for web and distributed composable applications
I think that it meets the guidelines. It is a matter of reposting it with the prefix "Show HN"?
agocorona··on Moving Haskell processes between nodes
Yes, I will add more examples as soon as I can. It is in an early stage, but I plan to update the article with more examples.
agocorona··on Moving Haskell processes between nodes
I'm the author. Thanks for publishing it here
agocorona··on Using backtracking to undo transactions in Haskell
Do you have seen the monad of the article before? I would like to know your reference, please.
agocorona··on Using backtracking to undo transactions in Haskell
I added the backtracking effect in this article without stacking a new transformer. In a way somewhat similar in which a new interpreter can add a new effect to a free monad.
agocorona··on Using backtracking to undo transactions in Haskell
Very glad that you appreciate it. I think that there is a gold mine of applications under this simple realization.
agocorona··on Using backtracking to undo transactions in Haskell
In STM the backtracking is a bit different. It has a single backtracking point and usually it is implemented by killing the thread and restarting it anew. That is because doing IO actions is really unsafe under STM. Really it is not implemented in Haskell but in C, at least the last time that I looked at it).

This backtracking is different since it permits different backtracking points. It is possible to implement a more "civilized" version of the STM semantics this way, with more respect for IO actions.

agocorona··on Take a look how reactjs is growing
http://www.google.com/trends/explore#q=reactjs%2C%20Angular....

;)

agocorona··on Programming at the specification level with Haskell
I think that there are objective measures of complexity. So there are objective measures of simplicity.

ideographic writing is more complex and less composable than phonetic writing and yet can express the same ideas.

Subjectively, a chinese can understand Chinese ideograms while maybe he find written English difficult to understand. But a Chinese would learn phonetic writing in less time than ideographic writing and would be capable to express complex ideas using the most composable writing system in less time, no doubt.

agocorona··on Programming at the specification level with Haskell
Well though. I agree with that. The good abstraction is more about interfaces rather than objects. I complain more about the primitive use of objects as message receivers" with state. That was at the moment the best solution available for the problem of managing events. But this idea of inversion of control pervaded all the industry in perverse ways Even where it was not necessary. The corporate OOP is mostly a consequence of that.

This is just random thoughts and there is much more to say. Neither I pretend to tell that OOP is wrong. What I say in the article is that the deconstruction of the recipe that OOP naturally demand is very painful and has too many drawbacks, and can be avoided with the right tools.

agocorona··on Programming at the specification level with Haskell
Hi

In the case of events, it is because I later have to store different event types in a List

so I define the list as [Event] . That is the container that feed the monad with events.

If I define Event as you suggest, I would need a existential type anyway.

    data Event a = Event EvType a

    data ListEvents= forall a.[Event a]
In the case of the continuations, I need to use a state monad that store this EventF data And I need to "erase" in some way the types to allow it to store them all for all events, no matter wich a and b they produce. I know that if in

    x :: IO a

    f :: a -> m b
If within the monad definition I store f (the rest of the computation) in the state monad, the type of this continuation when executed will be (m b) and it accept values of type `a` so I can coerce the continuation to this type even if I "erased" it when i put it in the state monad.

Anyway this approach has some problems that I solved in the second part

agocorona··on Programming at the specification level with Haskell
I added a bit more context. Thanks
agocorona··on Programming at the specification level with Haskell
No, I mean "the combinators that I just developed and want to explain here".
agocorona··on Programming at the specification level with Haskell
Too bad. I fixed it
agocorona··on Programming at the specification level with Haskell
It seems that there is no way to change the original URL
agocorona··on Programming at the specification level with Haskell
Very sorry: https://www.fpcomplete.com/user/agocorona/EDSL-for-hard-work...