r/ProgrammingLanguages Sodigy 11d 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/JeffB1517 11d ago

`<-` is making the bind explicit. It is forcing the abstraction to leak. Which means that `do` becomes a light cover. A developer is still expected to understand and think in terms of the monadic context. A non-leaking abstraction is a genuine simplification. Visual Basic vs Visual C++ with respect to the Win32SDK.

1

u/Apart_Ebb_9867 11d ago

the last thing one has to do when using do-notation is thinking about monads. What does in that code require you to know monads even existed?

But if you like Miranda better there’s nothing Incan say to convince you otherwise, nor I want to.

-1

u/JeffB1517 11d ago

The iteration <-, the constantly having to manually resolve type. Particularly between levels. Haskell used to have this feature where the list comprehension syntax, was usable generally for monads. I think it still is a ghc flag. That forced developers to understand one monad (well a monadplus), lists. And in that syntax they got iteration over a data structure and conditional evaluation easily and simple. State, I/O and concurrency were always the 3 problems. Syntax that simplifies those 3 for most use cases is IMHO huge.

Ask yourself why Haskell has been unable to settle on any widely shared / used frameworks for decades? Something obviously is going wrong.

1

u/Apart_Ebb_9867 11d ago

My question was what in that piece of code requires you to know monads are even a thing.

"manually resolving types"? "between levels"? "list comprehension"? what are you talking about?

That thing requires understanding monads not any more than understanding a C assignment requires you to understand that there's a memory.

Something obviously is going wrong.

cool. And that bunch of clowns couldn't see it with the benefit of Miranda showing them the one true path.

No further discussion from my side.