4 ms·
Glad to see there is a prettier way of doing it in Haskell! Do I understand then that this basically building up a sort of parallel language for expressions in
by colomon 17y ago
Glad to see there is a prettier way of doing it in Haskell!
Do I understand then that this basically building up a sort of parallel language for expressions in Haskell which optimize really, really well?
- dons 17y agoIn a way. It's a subset of Haskell focused on array operations that optimize really really well. You can use these instead of list operations, basically, and getter performance in all sorts of ways.
- eru 17y agoYou could get very good performance when you do the fusion manually, too. The really exciting thing about fusion is that it allows really fast code that _composes_ well. Composability is also what makes Haskellers excited about Monads and software transactional memory (STM). STM give composable concurrency --- in contrast with locks which are notoriously uncomposable.
- gwern 17y ago> Glad to see there is a prettier way of doing it in Haskell! Most Haskellers would write it a little differently from Don: 'main = print $ sum [1..n]'. The '..' is syntactic sugar over 'enumFromTo'.
- eru 17y agoI'd prefer main = print . sum $ [1..n] But that's almost the same.
- dons 17y agoYes, you can of course use lists. I'm interested in getting the compiler to produce the best code it can, hence I use slightly different libs and flags and such.
- eru 17y agoYour version is good. I just wanted to give a small sample of idiomatic Haskell code. Colomon's post (and his subsequent enlightened reply) were good parts of the discussion, too.