[m-users.] Self-improvement subjects.

Volker Wysk post at volker-wysk.de
Tue Oct 24 03:37:50 AEDT 2023


Am Montag, dem 23.10.2023 um 14:37 +0100 schrieb Sean Charles
(emacstheviking):
> What areas of maths / logic do I need to study to better understand the
> Mercury compiler?
> 
> I have a brain, so I have a chance.
> 
> What I find mostly confusing is all the talk of 'existential' things, from
> philosophy I know what Existentialism means but not when applied to a
> language like Mercury. 

Existential types (more precisely: types with existentially quantified type
variables in them) gave me a headache, too, at first. I recommend this page:

https://github.com/Mercury-Language/mercury/wiki/Existential-types

"Existential" refers to the existential quantifier in such types. As opposed
to the usual implicit universal quantifier (which can be made explicit, but
doesn't need to).

What that page doesn't say, is that for an existential type you will
probably also need a type class, so you can do more with it. 

You can think of an existential data constructor as a container for a value
that can have any type (possibly restricted to the members of a type class).
That type, encapsulated inside of it, isn't give out to the outside. This
means, it isn't restricted to anything from the outside.


> Also I still struggle with modes/inst and 'and-or' trees. I read the
> Wikipedia page on those until it stopped making sense (didn't take long),
> I have rough idea of what the Mercury manual is trying to tell me but I am
> sick and tired of feeling like a semi-educated simpleton and need to up my
> game.
> 
> When I learned Prolog, I did some study about Horne clauses, and some
> other related subjects but only enough really to understand what I was
> doing at the time time, and it got me further down the road.
> 
> But...Mercury. What a beast!   

Yes, insts are beasty.  :-))

> I truly want to get to know it's inner dialogue as it once again is forced
> to eat my probably horrendous code over and over.
> 
> So... any topic for self-study would be most appreciated.

Good luck,
Volker


More information about the users mailing list