What is the colon mean in the variant syntax?


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.


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


Thank you very much :smiley: