I once wrote a few hundred lines of OCaml at a previous job and was pleasantly surprised with the language, so I'm not opposed to getting more familiar with it :grinning:
I had a half-baked thought a couple weeks ago that multi parameter type classes don't seem all that useful and it might be possible to get away with interfaces that look more like what you'd find in other languages. Something like print :: Showable -> () instead of print :: Show a => a -> (). Now that I write this down it doesn't make a whole lot of sense :unamused:Very half-baked indeed
Ah, I read SYTC a while back. It seems that automatic dictionary-passing by the compiler is convenient to have. I wonder if implicit parameters helps. Needs more thought.
similarly it's convenient that the compiler will build instance dictionaries for you, but the cost is that classes and instances are not the same as types and values, and so you can't do first class functional programming with them
What would a strict impure Haskell be like? I started a hobby project to explore this question https://github.com/chrismwendt/talloy inb4 pitchforks
maybe you should try to add higher-kinded types to OCaml instead ;)
seriously, though, please report back with what you learn!
I once wrote a few hundred lines of OCaml at a previous job and was pleasantly surprised with the language, so I'm not opposed to getting more familiar with it :grinning:
In the readme it says "No type classes, only interfaces" what exactly do you mean by "interfaces" in this context?
I had a half-baked thought a couple weeks ago that multi parameter type classes don't seem all that useful and it might be possible to get away with interfaces that look more like what you'd find in other languages. Something like
print :: Showable -> ()
instead ofprint :: Show a => a -> ()
. Now that I write this down it doesn't make a whole lot of sense :unamused:Very half-baked indeed@Chris Wendt See "Haskell with only one typeclass"
also
instead of
is a perfectly good idea (although not the same as the one discussed in the link I sent). It even has its own acronym: "Scrap Your Type Classes"
It doesn't work that great in Haskell for various reasons, but if you're making a new language it's worth trying
This is bending my mind http://okmij.org/ftp/Haskell/Haskell1/Class1.hs
Ah, I read SYTC a while back. It seems that automatic dictionary-passing by the compiler is convenient to have. I wonder if implicit parameters helps. Needs more thought.
It's convenient in some ways, but inconvenient in other ways
E.g. it's convenient that you're guaranteed to never need type annotations in SYTC, but of course you pay a big price in losing polymorphism
similarly it's convenient that the compiler will build instance dictionaries for you, but the cost is that classes and instances are not the same as types and values, and so you can't do first class functional programming with them