What is the colon mean in the variant syntax?


#1

Hi all,

About this code snippet,

type t = 
  | T(int): t

I’d like to know what the colon is here. it doesn’t look like normal variant i saw in the document.

I didn’t see any document about it and I even don’t know which keywords I can use to google it.

Thanks a lot.


#2

That’s called a Generalized Abstract Data Type (GADT). See https://sketch.sh/s/yH0MJiujNSiofDWOU85loX/


#3

Thank you very much :smiley: