r/functionalprogramming • • Sep 21 '24

Question Ways to be a functional language

Every functional language needs two things, a functional part, and an escape hatch where it does stuff.

The functional parts are not all identical, but they are variations on the theme of "how can we express a pure expression?" It's syntax.

But then there's the escape hatch. Haskell has monads. Original Haskell defined a program as a lazy function from a stream of input to a stream of output and I would still like to know what was wrong with that. The Functional Core/Imperative Shell paradigm says you can be as impure as you like so long as you know where you stop. Lisp says "fuck it" 'cos it's not really a functional language. Etc.

Can people fill in the "etc" for me? What are the other ways to deal with state when you're functional?

21 Upvotes

17 comments sorted by

View all comments

17

u/[deleted] Sep 21 '24 edited Sep 21 '24

[removed] — view removed comment

2

u/catbrane Sep 21 '24

Not much use for CLI and GUI interfaces.

You can write CLI and GUI programs in Haskell without using monads (I wrote a multi-user snake game in Miranda!) but I agree it's very fiddly.

2

u/drinkcoffeeandcode Oct 01 '24

Multi-user snake in Miranda is OP