Handling records with shared substructure in Elm
I have some record types structured essentially like this: type Body x = { x | pos: (Int,Int) } type Bubble = Body { radius: Int } type Box = Body { width: Int, height: Int } Now I would like to have a mixed list of any of these and perform some operation on the Body part, but still special case handling Box and Bubble other times. For example, having (implementations elided): mv: (Int,Int) -> Body a -> Body a bubble: Bubble box: Box I would like to map (mv (1,1)) [box,bubble] but this fails because Elm deems the types in the list incompatible. Now I could wrap the Box es and Bubble s in an