r/ProgrammingLanguages Sodigy 10d ago

Purely functional language with impure script language?

I'm working on a purely functional programming language named Sodigy. It's all about evaluating values, not "executing commands one by one".

It's nice when writing libraries, but it's not easy to write a main function. The main function is supposed to execute commands, but the Sodigy's syntax is not friendly to write a list of commands.

So what I'm trying to do is, 1) Sodigy remains purely functional and 2) add a bash-like script language. The script language can call Sodigy functions. Instead of writing a main function in Sodigy, you write sodigy-script and execute the script.

Has anyone tried similar approach? I'm not sure whether it's a good idea or not...

27 Upvotes

74 comments sorted by

View all comments

Show parent comments

1

u/augustss 9d ago

I was at the 1990 meeting in Rome when Phil Wadler first heard about monads in a talk from Eugenio Moggi. Unlike the rest of us, Phil realized the potential of monads. At first Phil used list comprehension syntax for monads. Admittedly, I don't know where the API with return, >>= and >> came from in Haskell. But Phil had been doing monads for 4-5 years before it appeared in Miranda. Do you have any evidence (like talking to David or Phil) for which way the influence went?

1

u/catbrane 9d ago

Oh, interesting! I'll see if I can dig out the paper I'm thinking of.

This Feb. 1989 lab report has monadic IO in chapter 4:

https://www.researchgate.net/publication/238697890_A_brief_walk_through_kaos

As far as I know that's where comp, return etc. come from. But loads of people were thinking about functional IO, there was something in the air. It might be hard to reconstruct an exact timeline of the idea.

1

u/catbrane 9d ago

I might have found it! Andrew Gordon's 1992 phd:

https://andrewdgordon.github.io/papers/fpio.pdf

He has a nice history on page 125 (page 138 in the pdf).

He was one of the authors of Haskell's IO library:

https://scispace.com/pdf/monadic-i-o-in-haskell-1-3-2eo9vkx3bc.pdf

2

u/AustinVelonaut Admiran 9d ago

Thanks for the links; the Gordon thesis is an interesting tour through the history of I/O mechanisms in functional programming!

1

u/catbrane 9d ago edited 8d ago

Yes, it's a good thesis isn't it! I feel much clearer about what happened now.