Follow

@Serpent7776 I love Haskell tuples and their "some stuff gets an annotation" semantics. Pythons tries to go this way with the tuples-that-aren't-quite-lists, but drops the ball halfway.

@dpwiz Can you expand on the "some stuff gets an annotation"? I'm new to haskell.

@Serpent7776 The tuple (pair) in Haskell is treated like a single-element container. The left element is "annotation" and the right is "value being annotated".
This allows transforming the value while preserving the annotation.

("Example", 12345) :: (Text, Int)

fmap (> 0) ("eg", 12345) = ("eg", True)

traverse load ("my cat", "cat.jpg") -- replaces the image source with it's content while keeping the title.

@dpwiz That's an interesting design. Does this relates to the Either type?

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.