r/ProgrammingLanguages • Sodigy • Jul 29 '26

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 comment

1

u/AustinVelonaut Admiran Jul 29 '26

That's almost exactly what I did in Admiran (define the monadic operations as regular function names, although I used $right and $bind instead of $then and $comp, to more closely match the Haskell operator names >> and >>=. Then during module import code can use these names directly like the above example, or alias them to infix operators more like Haskell (which is what I prefer).

I do like the names $then and $comp, though; they express the idea well!

1

u/catbrane Jul 29 '26

Haskell used comp, return and then as well back in 1992. The operators came a little later.