Strict impure Haskell - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Chris Wendt

What would a strict impure Haskell be like? I started a hobby project to explore this question https://github.com/chrismwendt/talloy inb4 pitchforks

Strict impure Haskell. Contribute to chrismwendt/talloy development by creating an account on GitHub.
Matt Peddie

maybe you should try to add higher-kinded types to OCaml instead ;)

Matt Peddie

seriously, though, please report back with what you learn!

Chris Wendt

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:

Julian KG

In the readme it says "No type classes, only interfaces" what exactly do you mean by "interfaces" in this context?

Chris Wendt

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

Asad Saeeduddin

also

data Show a = Show { show :: a -> String }

print :: Show a -> a -> IO ()

instead of

class Show a
  where
  show :: a -> String

print :: Show a => a -> IO ()

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"

Asad Saeeduddin

It doesn't work that great in Haskell for various reasons, but if you're making a new language it's worth trying

Chris Wendt

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.

Asad Saeeduddin

It's convenient in some ways, but inconvenient in other ways

Asad Saeeduddin

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

Asad Saeeduddin

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