Hacker News new | past | comments | ask | show | jobs | submit login
The Clean Language (ru.nl)
87 points by michaelsbradley on Dec 23, 2021 | hide | past | favorite | 43 comments



Having never heard of this, I found the FAQ page an informative starting point.

https://clean.cs.ru.nl/FAQ

In simplistic terms, Clean seems to be a “better Haskell”.

Edit: I just downloaded the bundle tar, looked at some sources and found out that vim has syntax coloring for Clean out of the box. Vim never ceases to amaze me.

More Edit: Clean transpiles to C, which means that when you look at generated code, or just disassemble the resulting binary, you will probably be able to make sense of what you see. When I disassemble a Haskell binary, I can't make heads or tails of it.


As I tried both Clean and Haskell, for me Clean is "worse Haskell".

As one example, Clean did not support non-latin1 alphabets in the UI library and my attempt to somehow correct the situation was in vain, the next release of the language did contain the same error. In contrast, when I discovered non-linear (at least quadratic) behavior in relatively fringe case of type checking algorithm in ghc, it was corrected quite quickly.

As per language themselves, Clean purported to have uniqueness types which should make programming better and easier and Clean developers came with special syntax to reuse same names during processing unique-typed values. Which is essentially a Haskell's do notation in disguise, except it cannot be used for different purposes, like non-deterministic List monad. At about 2008 or slightly earlier, type system of Haskell became powerful enough to erase bindings from environments (famous HList by Oleg Kiselyov), allowing one to express many things, including linear and unique types (example [1] - if state's parameters can change number of bindings, we can check for bindings' erasure, expressing linear (all bindings are erased, except ones returned) and unique (some bindings can be left) types).

[1] http://blog.sigfpe.com/2009/02/beyond-monads.html

I keep saying what is language feature in regular programming languages is a library in Haskell. Clean is no exception.


You can't compare fixing some quadratic time behavior in one place (the type checker) to something that sounds like could be a major piece of work: multilingual character support in UI. If it only goes to ISO latin, it's probably using 8 bit strings, and assuming that bytes and characters are 1:1.

Also, the average Haskell developer practically exists for the purpose of fixing quadratic behaviors in type checkers; you file that bug at 3 a.m. on December 25, and by 8 you have a shiny fix under the tree.


Here it is: https://mailman.science.ru.nl/pipermail/clean-list/2002/0021...

The code I've asked contains two calls instead of one, aside of that it was quite simple and would allow at least Russian users of Clean to have proper dialog titles.

I guess it is nothing like "major piece of work". It was a fix for peculiarities of Windows UI of that era - dialog titles required different approach than dialog fields.


Cool that you found this. I’m a student at this university and most alumni I’ve spoken say it is only used for research and a masters degree course course [1]. What’s interesting is that the bachelor course on functional programming gets thought in Haskell.

[1] https://sis.ru.nl/osiris-student/OnderwijsCatalogusSelect.do...


The undergraduate course was taught in Clean until a few years ago. Learning functional programming in Clean is a nightmare because it is impossible to find any helpful resources online about the language and the tooling is useless compared to Haskell's.


> In simplistic terms, Clean seems to be a “better Haskell”.

Actually Haskell is a better (or at least, standardised) Clean.

There was a lot of interest in lazy functional programming in the 1980s, but everyone made their own mutually-incompatible systems (e.g. Clean, Miranda, and I heard that even Scheme was debating laziness at one point).

Eventually a committee came together to standardise on a single language (which could be extended in interesting ways). The result was Haskell.


An important point was to be non-proprietary, wasn't it? Clean and Miranda were proprietary, although the implementations are now available with permissive licences.

Edit: I don't know about Scheme debating laziness as such, but there's Friedman and Wise https://help.luddy.indiana.edu/techreports/TRNNN.cgi?trnum=T... and there was Lispkit Lisp, as in Hoare's CSP book.


It's a pity this info is so hard to find. I had to click for a minute to find some example code, and thought: this is very much like Haskell.

I wonder how it's better than Haskell, why not Idris/Coq/Adga, and why not contribute to any of the just mentioned projects. This info, combined with some code and a description of the target audience of the project would be very helpful indeed.


> I wonder how it's better than Haskell

I don't think anybody claims it's better than Haskell. It predates it, for one. The Clean programming language is its own thing, with its own philosophy, uniqueness types, etc.

Don't be mislead by the usual online flamebait trying to turn everything into "X is better than Y". This is usually claimed by people with little experience in either X or Y.


Also, Clean is listed as a particular influence in the Haskell Report.


I'd never heard of it, either, but its Wikipedia page[1] says it's been around since 1987, so it's a little bit older than Haskell.

[1]: https://en.wikipedia.org/wiki/Clean_(programming_language)


I remember looking at Clean at the time when Haskell98 was new. It had uniqueness types at the time and this seemed really cool for efficient destructive updates. But all the excitement was with Haskell.


[flagged]


> At least according to the average Haskell programmer.

That's false.


Only if you treat language as a religion :)

I suspect this is more a question of experience than of language. Getting too carried away with the idioms and properties of a specific language will be mitigated by learning about different computation models / type systems and the languages that implement them. Sooner or later you learn that software development is about trade-offs and you choose the right tool for the job.


Nice meme, but many haskellers are interested in other programming languages, such as Idris.


I used clean at school. Honestly it's basically Haskell without any libraries, much, much shittier errors and a bit more arcane syntax.

I wouldn't really advise anyone to learn it since Haskell is superior in almost every way.


And here I thought names couldn't be any more ambiguous than go and (to a slightly lesser extent because I use it less in normal conversation) rust. Here, even if you append lang(uage) I'm still not expecting a programming language when clicking the link.


Rust isn’t as ambiguous as you would think, but it’s ambiguous in a specific and annoying way: there is a popular game called Rust, and it very often shows up in my search results when I’m coding. For as much as search engines supposedly tailor their results, you’d think they would have figured out by now I never ever want results from that game.


Someone should make a Language language already.

(Let it be Microsoft or Google, for bonus points.)


Meanwhile the lisp comunity...


Woa, I never even realized lisp is something other than a programming language actually. Non-native speaker, but still, the walls of my bubble must be thick...


With unique types and offering an alternative to monadic approach to pure functional programming, I always had an eye out for this language. I always found its syntax rather clean (no pun intended). Sadly there hasn't be much activity. or at least not much that could be discerned from its public facing website. I would love to see a revival in interest and development.


If I'm not mistaken, wasn't Clean closed source and commercial for a long time?

I was very interested years ago, but I kept on thinking that without opening up it would eventually just fade into oblivion and never went beyond the toying phase. A common fate for the many languages with a single and commercial reference compiler/interpreter.


I seem to recall the same (of it being closed source initially)


I'd love to learn some about the "alternative to monadic approach to pure functional programming" but the project's website is utterly useless in helping me to find it.


The documentation [1] has a bit of information about using uniqueness types for IO and other cases.

[1] https://clean.cs.ru.nl/download/html_report/CleanRep.2.2_11....


Clean has used uniqueness types since the 80s. Monadic effects were only discovered/implemented in the 90s. In fact, Haskell 1.0 didn't have monadic I/O either; AFAIK it implemented I/O using a "stream of actions", but that doesn't compose very well (e.g. we can get deadlocked if an earlier action depends on the result of a later action)

Uniqueness types are similar to to linear types (as found in Idris, ATS, and recently Haskell), and similar to Rust's 'ownership' model ("affine types"?)


I remember a rather comprehensive online pdf manual/book back in '99 when I went Clean for a period.


I never heard of Uniqueness type (https://en.wikipedia.org/wiki/Uniqueness_type). Anyone can simply explain pro/contro of this versus monads?


The IO monad (in Haskell) will always be the same, no matter how much I/O you perform. A unique File type, for instance, will be different before and after I/O, reflecting that side effects are not idempotent. In other words, a change in mutable state is reflected in a change of type.


I'd love to see an example of this (the wikipedia page is not very clear to me).

Is there a Clean or Idris program somewhere I can have a look at?


Mercury has them too:

https://www.mercurylang.org/information/doc-latest/mercury_r...

useful for things like file descriptors. The type system will, for example prevent sharing of your file descriptors between threads.


I consider Unique as user-defined affine types— half of what makes up a linear type.

Clean and Mercury are both mentioned in: https://en.m.wikipedia.org/wiki/Substructural_type_system


I studied clean a very long time ago, maybe 20 years, so I have no idea any more what the code looks like, but I can attempt to tell you the basic idea of this. There are objects that you cannot copy and also not use in multiple places as a function argument. E.g., if something is a file it is subject to these restrictions and functions that write to the file would accept the file as an argument and return a new object of type file that stands for the modified version of the file. This forces an explicit sequencing of side effects. This prevents the old version of the file still being usable in the code.


For a language called clean, it has a messy website.


How hard is it to include a syntax snippet?

Same as with a lot of FOSS software which has a really long essay as explanation but not one screenshot of the GUI


There's a link to a page full of syntax examples in the first paragraph.

https://clean.cs.ru.nl/Quick_impression


Syntax matter few for this language I assume.


IIRC I looked at Clean 10+ years ago and it was not BSD licensed; either closed source or some restrictive license. And that made me not invest any time into trying it out.

Do I remember this correctly? Does anyone know/remember?


Answering my own question...

From looking at https://gitlab.science.ru.nl/clean-and-itasks/clean-ide/-/co...

  - Clean used to be dual licensed: commercial license + LGPL
  - 3 years ago LGPL was replaced by Simplified BSD
  - 7 months ago the commercial license was removed


Thanks I was wondering it myself!


It is possibly the cleanest dead language out there!

> December 12 2019: Programming Languages in the Netherlands




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: