CSRG-Group/dcs-notes.github.io

Type family example typo?

EdmundGoodman opened this issue · 4 comments

Describe the bug
The notes on writing a type family for type level addition differ from the sample solutions in the 2019 sample paper, the notes use the promoted type 'Zero and 'Succ, whereas the sample solutions use the values Zero and Succ

To Reproduce
Go to the section: https://warwick.guide/CS141/type-level-programming#closed-type-families

Expected behavior
Same as sample answers, unless those contain a typo

Screenshots
image
image

I'm not sure if this is a mistake - it could be a typo on either end or work both ways, but I'm still revising type-level stuff so I don't think I know it well enough to comment. If you think it's not a mistake on our end, we could bring in Michael to see what he thinks

image

The notes are in-line with lecture slides, I actually asked Michael about something similar to this and I haven't included his answer to me in the notes yet but basically Zero and 'Zero are actually the same thing. You could use both and Haskell will infer that it is the type Zero not the data constructor Zero. It is abit ambiguous which is what Michael said and he says that for recently he has decided to remain consistent and use 'Zero instead of the ambiguous Zero.

image

Don't delete this issue just yet, I think we could probably include this somewhere in the notes and we can also label this a good issue to look at for now! Thanks for spotting this!

Cool - just thought I'd flag it up

Cool - just thought I'd flag it up

Yup thanks for spotting it, I haven't got to 2019 paper yet haha