Live data from Hacker News

Show HN: Legion, an as-simple-as-possible blockchain server written in Haskell

github.com

31–40 of 73 posts

Re: Show HN: Legion, an as-simple-as-possible blockchain server written in Haskell

#31

... had this been written in a language less esoteric than Haskell, it would've been even better for the rest of us :)

I suggest you take a look at https://github.com/lhartikk/naivechain , the original version of this work, written in JS

I second the recommendation for Naivechain. It is really easy to understand.

For me, reading the Javascript code of Naivechain made me understand Blockchains in an easier-to-understand way than all the tutorials that try to explain how to implement a blockchain!!

Re: Show HN: Legion, an as-simple-as-possible blockchain server written in Haskell

#32
post #29

Nicely done. It reads like Ikea instructions. I didn't really know how blockchain worked until I read this code. If this was written as a teaching tool or a portfolio piece or even an art project, then I say its a big success. One question: getBlockChain :: (SpockState m ~ BlockChainState, MonadIO m, HasSpock m) => m [Block] What does the squiggle mean?

If you learned a thing about blockchains from this project, I'd call it a big success too! :D So happy to hear it was helpful

Re: Show HN: Legion, an as-simple-as-possible blockchain server written in Haskell

#33
post #29

Nicely done. It reads like Ikea instructions. I didn't really know how blockchain worked until I read this code. If this was written as a teaching tool or a portfolio piece or even an art project, then I say its a big success. One question: getBlockChain :: (SpockState m ~ BlockChainState, MonadIO m, HasSpock m) => m [Block] What does the squiggle mean?

It is an equality assertion: https://downloads.haskell.org/~ghc/7.6.1/docs/html/users_gui...

Thanks, but I still don't get it. So SpockState m equals BlockChainState? So getState's type is m BlockChainState?

    (BlockChainState chain _ _) 
But it has to be anyway so, I guess I'm still confused. Is the squiggle for extra documentation or is it a hint to help the type inference? Why would type inference need help? Does it have to do with some of the extensions that are applied in the source (but appear to be otherwise unused)?

Re: Show HN: Legion, an as-simple-as-possible blockchain server written in Haskell

#34

... had this been written in a language less esoteric than Haskell, it would've been even better for the rest of us :)

Well uh, value judgements aside my reading of those code is that it is short, straightforward in its choices and generally quite good.

I'm not sure what there is to be mad about. This seems pretty approachable.

Re: Show HN: Legion, an as-simple-as-possible blockchain server written in Haskell

#35

Of course there are name collisions everywhere, but, there's a metacomputing/grid computing/distributed OS thingie named "Legion" from the University of Virginia that has a bunch of papers about it in the CS literature. Oh, and we saw off the American Legion threatening to sue us by saying "We're the State of Virginia, go right ahead..."; what's your strategy? :-)

You mean this project might be summoning daemons that will claim, "Our name is Legion"?

http://bible.oremus.org/?ql=363093142

Re: Show HN: Legion, an as-simple-as-possible blockchain server written in Haskell

#36
post #35

Of course there are name collisions everywhere, but, there's a metacomputing/grid computing/distributed OS thingie named "Legion" from the University of Virginia that has a bunch of papers about it in the CS literature. Oh, and we saw off the American Legion threatening to sue us by saying "We're the State of Virginia, go right ahead..."; what's your strategy? :-)

You mean this project might be summoning daemons that will claim, "Our name is Legion"? http://bible.oremus.org/?ql=363093142

Humorously, the professor who named it thought the quote was from Heinlein. Not much of a Bible-reader.

Edit: Apparently I'm not very good at remembering my SciFi, maybe it's this? https://en.wikipedia.org/wiki/My_Name_Is_Legion_(short_story...

Re: Show HN: Legion, an as-simple-as-possible blockchain server written in Haskell

#37
post #29

Nicely done. It reads like Ikea instructions. I didn't really know how blockchain worked until I read this code. If this was written as a teaching tool or a portfolio piece or even an art project, then I say its a big success. One question: getBlockChain :: (SpockState m ~ BlockChainState, MonadIO m, HasSpock m) => m [Block] What does the squiggle mean?

If you learned a thing about blockchains from this project, I'd call it a big success too! :D So happy to hear it was helpful

Thanks for making this. It reminds me of the day I fell in love with Haskell. I wanted to learn how a Verilog simulator works. There's a couple good open-source ones but I found the code impenetrable, so I went looking for something like an introductory course and found this obscure, disused code called Hydra which is hard to find. Let me see ... here it is:

https://github.com/garry-sharp/x/tree/master/CA4/HydraLib-0....

After reading for just an hour, the lightbulb came on and I not-only felt I had learned how a digital simulator works but also what a mighty hammer Haskell can be for teaching.

Since then I've read (and unfortunately written) a lot of Haskell that is far less elucidating. It's great to come across something that reminds me how I got turned on in the first place and that I should aspire to produce code that not-only barely gets the job done but also explains itself and embodies a modicum of beauty. Thanks again.

Re: Show HN: Legion, an as-simple-as-possible blockchain server written in Haskell

#39
post #33

Earlier quoted context omitted.

It is an equality assertion: https://downloads.haskell.org/~ghc/7.6.1/docs/html/users_gui...

Thanks, but I still don't get it. So SpockState m equals BlockChainState? So getState's type is m BlockChainState? (BlockChainState chain _ _) But it has to be anyway so, I guess I'm still confused. Is the squiggle for extra documentation or is it a hint to help the type inference? Why would type inference need help? Does it have to do with some of the extensions that are applied in the source (but appear to be other…

Yeah, it's for the compiler, otherwise it can't figure out that a BlockChainState is actually a SpockState m. I'm not really sure how it could otherwise, since the definition is completely decoupled from Spock.

It should be noted that it's entirely possible there's a less confusing way to write that type signature. I'm far from an expert in Haskell.

Re: Show HN: Legion, an as-simple-as-possible blockchain server written in Haskell

#40

I'm tempted to just make a youtube video going over this code line by line. It's a really great introduction to a non-trivial bit of Haskell.

That would be awesome! Hopefully over time I (or anyone contributing) can spend a little more time making it as idiomatic as possible and beefing up the docs a little bit.

Please let me know if you end up doing that!

Post reply on HN