
Miranda: A non-strict functional language with polymorphic types (1985) [pdf] - tjalfi
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.105.6357&rep=rep1&type=pdf
======
derriz
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)](https://en.wikipedia.org/wiki/Gofer_\(programming_language\))

~~~
rjeli
I agree that Haskell guards are aesthetically uglier, but they're much easier
to read with the conditional before the result.

~~~
theoh
Someday the equivalence between the notations will make it possible to (gasp)
automagically translate between the two. If we're still typing programs.

~~~
rjeli
And then we'll have AST wars instead of language wars... unless we can compile
to and from Turing machine instructions :-D

~~~
Risord
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.

------
hyper_reality
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.

~~~
bstamour
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.

~~~
dmix
Interesting, is Haskell used in many universities?

~~~
tomsmeding
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.

~~~
solidangle
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).

------
tmccrmck
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....](https://www.cs.kent.ac.uk/people/staff/dat/miranda/wadler87.pdf)

~~~
Jtsummers
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.

~~~
dmix
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.

------
bstamour
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.

------
nevster
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!"

~~~
mreid
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.

------
danidiaz
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](https://www.youtube.com/watch?v=QVwm9jlBTik)
It touches on Miranda from 35:00.

~~~
marktangotango
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.

------
justdionysus
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...](https://www.microsoft.com/en-
us/research/publication/implementing-functional-languages-a-tutorial/)

------
jonstewart
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.

------
msie
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.

------
mschrage
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!).

~~~
Johnny_Brahms
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.

------
agumonkey
Haskell godmother right ?

~~~
spdegabrielle
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.

------
brudgers
Miranda home: [http://miranda.org.uk/](http://miranda.org.uk/)

------
lngnmn
Look, Ma, it is Haskell.

