#"Wrapped" custom types

1 messages · Page 1 of 1 (latest)

wet mango
#

I am working through the Gleam Exercism track and the Pizza Pricing example states that "ExtraSauce and ExtraToppings should wrap the Pizza type." Is there any documentation about what the syntax and/or design pattern of one type "wrapping" another looks like in Gleam? I am having trouble finding anything concrete by searching Google or Discord (other than this discussion thread: https://github.com/gleam-lang/gleam/discussions/1398).

Thanks in advance!

latent smelt
#

iirc ExtraSauce and ExtraToppings should be 'recursive', where they can themselves have a pizza 'in' them

#

lemme go

#

find my code

worldly root
#

Wait a second

latent smelt
#

idk how to word it better

worldly root
#

Oh nvm I get it

latent smelt
#

it's uh 0120 hours rn so

worldly root
#

Yeah I was confused that it being a recursive type meant you were stacking pizzas but I’m just an idiot

wet mango
#

Ah, I was trying to define a whole separate type for the Extra* stuff like

type ExtraSauce {
  ExtraSauce(Pizza)
}

Which the compiler did not like. I see where I was going wrong now. Thank y'all!

latent smelt