News for hackers. Stuff that matters.
Re:Grain: A strongly-typed functional programming language f... by tomp on Tuesday July 31, 2018 @03:52AM (#17651328)
I wonder how they handle array out-of-bounds accesses...
Re:Grain: A strongly-typed functional programming language f... by masklinn on Tuesday July 31, 2018 @05:57AM (#17651843)
Likely like Elm, where indexing into an array returns a Maybe. OOB return Nothing, while in-bound returns Just <value>.

Or they don't support indexing at all.

Re:Grain: A strongly-typed functional programming language f... by dleclere on Tuesday July 31, 2018 @04:17AM (#17651438)
Looks like they're using an indexed Algebraic Data Type.

https://github.com/grain-lang/grain/blob/master/src/grain-st...

Re:Grain: A strongly-typed functional programming language f... by masklinn on Tuesday July 31, 2018 @05:59AM (#17651849)
There's no indexing in that.
Re:Grain: A strongly-typed functional programming language f... by vilu on Tuesday July 31, 2018 @04:05AM (#17651384)
Maybe by making the API of index based list datatypes return the value inside of a container type. In general it's a helpful strategy when creating total functions.