News for hackers. Stuff that matters.
Re:Miranda: A non-strict functional language with polymorphi... by derriz on Wednesday May 03, 2017 @04:45PM (#14259893)
Being introduced to Miranda was a revelation to me back in the day. I still prefer aspects of Miranda syntax over Haskell. For example, the formatting of guards in Miranda:

  gcd a b = gcd (a-b) b, if a>b
          = gcd a (b-a), if a<b
          = a,           if a=b
versus Haskell

  gcd a b | a>b  = gcd (a-b) b
          | a<b  = gcd a (b-a)
          | a==b = a
I know it's a small thing and you can get used to such differences but since FP became just an occasional side interest for me, I never made the switch as a heavyish Miranda user to Haskell. For a long time even getting a Haskell compiler to run was a massive pain.

So I started using Mark Jones' Gofer[1] interpreter which was trivial to build and still is 20 years later assuming you can find the source tar ball. It kept the nicer syntax of Miranda and added most of the power features of Haskell. I particularly liked the generalized list comprehension feature which really should have made it into Haskell; things like combinator parser code reads beautifully with it.

I know it's what you're used to but Haskell code always looks ugly to me in comparison to Miranda or Gofer.

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

Re:Miranda: A non-strict functional language with polymorphi... by rjeli on Wednesday May 03, 2017 @05:45PM (#14260449)
I agree that Haskell guards are aesthetically uglier, but they're much easier to read with the conditional before the result.
Re:Miranda: A non-strict functional language with polymorphi... by theoh on Wednesday May 03, 2017 @06:19PM (#14260742)
Someday the equivalence between the notations will make it possible to (gasp) automagically translate between the two. If we're still typing programs.
Re:Miranda: A non-strict functional language with polymorphi... by rjeli on Wednesday May 03, 2017 @06:29PM (#14260800)
And then we'll have AST wars instead of language wars... unless we can compile to and from Turing machine instructions :-D
Re:Miranda: A non-strict functional language with polymorphi... by Risord on Thursday May 04, 2017 @06:50AM (#14263904)
Hopefully we skip that AST phase and go directly more meaningful and still less visual related layer. Is it called ASG or something.

Edit: We probably have wars anyway but I think after that our wars are about something that really matters.

Re:Miranda: A non-strict functional language with polymorphi... by n4r9 on Thursday May 04, 2017 @03:31AM (#14263188)
I found the Miranda version much easier to read. But then I'm a mathematician who has never used Haskell, and it's fairly similar to how mathematicians write multi-line functions.
Re:Miranda: A non-strict functional language with polymorphi... by houli on Wednesday May 03, 2017 @07:51PM (#14261294)
It's mentioned in the Wikipedia article that monad comprehensions are available as a GHC language extension
Re:Miranda: A non-strict functional language with polymorphi... by i_don_t_know on Thursday May 11, 2017 @05:20AM (#14314784)
I vaguely seem to remember that the designer's of Haskell picked a different syntax for guards to make the language look less like Miranda. Miranda was owned by a private company (IIRC) and they didn't want to run the risk of infringing on their IP. But I don't know if that's really true.
Re:Miranda: A non-strict functional language with polymorphi... by GregBuchholz on Wednesday May 03, 2017 @07:02PM (#14261008)
If you like "if guards", and want a non-whitespace delimited, strict, dynamically typed language, check out the Pure language:

    gcd a b = gcd (a-b) b if a>b;
            = gcd a (b-a) if a<b;
            = a           otherwise;
https://agraef.github.io/pure-lang/
Re:Miranda: A non-strict functional language with polymorphi... by hyper_reality on Wednesday May 03, 2017 @03:01PM (#14258965)
It's funny you posted this, because today was examination day for the 'Functional Programming in Miranda' course at University College London, one of the last institutions to actually teach a course in Miranda.

Indeed, it's a great stepping stone to Haskell, with many of the important functional concepts but without some advanced (albeit useful) stuff like monadic programming.

One of the downsides is the ancient Mira console, which can output cryptic error messages, and which doesn't have command history out the box. Nevertheless, it's lightyears faster to start than GHCI, so good for learning.

Re:Miranda: A non-strict functional language with polymorphi... by wetmore on Wednesday May 03, 2017 @05:44PM (#14260436)
> and which doesn't have command history out the box

SML/NJ had the same issue; you can use rlwrap[0] to fix that.

[0]: https://linux.die.net/man/1/rlwrap

Re:Miranda: A non-strict functional language with polymorphi... by bstamour on Wednesday May 03, 2017 @03:51PM (#14259382)
The University of Windsor used it in their first year intro to CS course up until 2015. I wonder how many other places still use it.
Re:Miranda: A non-strict functional language with polymorphi... by stealthefocus on Wednesday May 03, 2017 @08:54PM (#14261589)
Yup I learned it there. It's there for the basics of CS like learning recursion they don't really mention if it is functional tbh.
Re:Miranda: A non-strict functional language with polymorphi... by dmix on Wednesday May 03, 2017 @04:10PM (#14259556)
Interesting, is Haskell used in many universities?
Re:Miranda: A non-strict functional language with polymorphi... by tomsmeding on Wednesday May 03, 2017 @05:11PM (#14260127)
Multiple universities (at least Utrecht and Nijmegen) in the Netherlands use Haskell for teaching functional programming, and I believe some FP research is also carried out there using Haskell.
Re:Miranda: A non-strict functional language with polymorphi... by solidangle on Wednesday May 03, 2017 @08:17PM (#14261436)
Radboud University actually switched to Haskell this year, now that Ralf Hinze is teaching the functional programming course. Before they used to teach Clean (which is not that different from Haskell).
Re:Miranda: A non-strict functional language with polymorphi... by tOOtl on Wednesday May 03, 2017 @04:21PM (#14259680)
UCL teaches other courses using Haskell (http://www.cs.ucl.ac.uk/students/syllabus/undergrad/101p_pri...), and Imperial College London uses it for teaching functional programming too (http://www.imperial.ac.uk/computing/current-students/courses...).
Re:Miranda: A non-strict functional language with polymorphi... by asQuirreL on Wednesday May 03, 2017 @05:18PM (#14260207)
Oxford also taught a few courses in Haskell:

- Functional Programming - Digital Systems - Principals of Programming Languages.

Compilers was primarily in OCaml, and there were several other courses in Scala.

Re:Miranda: A non-strict functional language with polymorphi... by wyager on Thursday May 04, 2017 @02:12AM (#14262849)
UT Austin used Haskell as the intro freshman language until pressure from large regional donors/employers caused them to switch to Java in the early 2000s.
Re:Miranda: A non-strict functional language with polymorphi... by bstamour on Wednesday May 03, 2017 @04:13PM (#14259594)
I'm not sure, honestly. It would be nice if it were.
Re:Miranda: A non-strict functional language with polymorphi... by tmccrmck on Wednesday May 03, 2017 @03:24PM (#14259164)
If you enjoyed this paper than I highly encourage you to read Wadler's 'Why calculating is better than scheming' where in he critiques SICP for it's choice of using Scheme, arguing that Miranda would have been a better language to go with.

https://www.cs.kent.ac.uk/people/staff/dat/miranda/wadler87....

Re:Miranda: A non-strict functional language with polymorphi... by Jtsummers on Wednesday May 03, 2017 @04:48PM (#14259918)
Interesting, I've read this before but it connects to some things I've been thinking about and discussing with people recently. A comment I made earlier today was about the value of static/expressive type systems, and how that can let you quickly go from specification -> code. My point being the relatively short semantic distance between many specification languages and the type systems in Ada/Haskell/others.

You get a similar effect in connecting between intent and code when using a more algebraic language versus the Algol-lineage and Lisp-lineage languages. You reduce the semantic distance (especially paired with a good type system from above) from your specification to your executable code.

Re:Miranda: A non-strict functional language with polymorphi... by dmix on Thursday May 04, 2017 @12:47PM (#14266383)
I agree in terms of pure utility that that makes a lot of sense. You basically spec it out via setting up types.

But in the context on SICP I'm not sure that would be ideal. As that book is about teaching 101 programming by introducing you to the idea of black box abstraction and building a program through layers of abstraction.

Starting with types would be an entirely different approach to go at it.

So personally, in my ideal university, I'd prefer to learn Scheme/LISP as the 101 course introduction to programming and learn a Haskell-esque language the following term and thereafter.

Although that being said, I used a practical language as my introduction to programming (Ruby) before diving into SICP - which really taught me programming. So maybe it's worth going with practical first, then diving into the theoretical underpinning so you fully appreciate and grasp what you are doing.

Re:Miranda: A non-strict functional language with polymorphi... by bstamour on Wednesday May 03, 2017 @02:30PM (#14258681)
We used Miranda in my first year intro to CS course back in 2006. It was still used at my university up until last year. Others may disagree, but I feel that it's a fine language for teaching fundamental CS concepts like recursion/induction, formal reasoning about your programs, data types, etc.
Re:Miranda: A non-strict functional language with polymorphi... by nevster on Wednesday May 03, 2017 @07:53PM (#14261306)
This took me back. It was the first language taught to us in Computer Science at UNSW (1989).

I remember the first lecture went something along the lines of "Ok, all you smart arses who've mucked around at home with BASIC and think you can program. We're going to teach you Miranda!"

Re:Miranda: A non-strict functional language with polymorphi... by mreid on Wednesday May 03, 2017 @09:49PM (#14261808)
Ditto. That was the first language I was taught at UNSW (in 1993). It was quite a change from the BASIC, assembler, and C I had taught myself in high-school.
Re:Miranda: A non-strict functional language with polymorphi... by danidiaz on Wednesday May 03, 2017 @03:59PM (#14259455)
This talk by David Turner gives a good overview of the development of "lazy, strongly typed, polymorphic, higher order, purely functional languages" https://www.youtube.com/watch?v=QVwm9jlBTik It touches on Miranda from 35:00.
Re:Miranda: A non-strict functional language with polymorphi... by marktangotango on Thursday May 04, 2017 @01:08AM (#14262581)
Thanks for posting this, as someone who poked around functional languages for years, this lecture really pulled together a lot of ideas. Im amazed at the ability of a good teacher (world class even) to illuminate complex subjects.
Re:Miranda: A non-strict functional language with polymorphi... by justdionysus on Wednesday May 03, 2017 @08:06PM (#14261380)
Miranda was used as the implementation language for the "Implementing functional languages: a tutorial"[0] book co-authored by SPJ. The book is well constructed (and free).

[0]: https://www.microsoft.com/en-us/research/publication/impleme...

Re:Miranda: A non-strict functional language with polymorphi... by jonstewart on Wednesday May 03, 2017 @08:55PM (#14261595)
Had a taste of both Miranda and Prolog in my college programming languages course (2000?). Miranda made it much easier for me to reason about C++ templates a few years later when C++ compilers finally started getting better.
Re:Miranda: A non-strict functional language with polymorphi... by msie on Wednesday May 03, 2017 @04:40PM (#14259855)
I learned Miranda at SFU way back in the 90's. It was a language way ahead of its time back then. I'm glad to see that so many languages nowadays have some of the stuff I worked with in Miranda.
Re:Miranda: A non-strict functional language with polymorphi... by mschrage on Thursday May 04, 2017 @02:33AM (#14262930)
Also reminiscent of OCaml, which is taught in the introductory sequence of CS classes at Harvard (CS51). Introducing CS students to functional programming early on is valuable for distancing Computer Science, the field, from the mechanics of programming.

Also pretty sure that the CS51 class is sponsored by Jane Street Capital (one of the few companies in the world that uses the language!).

Re:Miranda: A non-strict functional language with polymorphi... by Johnny_Brahms on Thursday May 04, 2017 @05:36AM (#14263649)
Few? Well, that is of course relative, but I have worked in at least 3 companies where ocaml has been used in parts of the company codebase.
Re:Miranda: A non-strict functional language with polymorphi... by agumonkey on Wednesday May 03, 2017 @02:34PM (#14258718)
Haskell godmother right ?
Re:Miranda: A non-strict functional language with polymorphi... by spdegabrielle on Wednesday May 03, 2017 @05:04PM (#14260078)
Yep. I think the licence was a barrier to the sort of research that Haskell has been subject to. Probably misremembering a podcast with SPJ tho.
Re:Miranda: A non-strict functional language with polymorphi... by brudgers on Wednesday May 03, 2017 @11:52AM (#14256831)
Re:Miranda: A non-strict functional language with polymorphi... by lngnmn on Thursday May 04, 2017 @01:25AM (#14262630)
Look, Ma, it is Haskell.