{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreiehnkyawreze6rb2slda23ppp6hac6xj5wtft5hbvdz6i4zedubmq",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mksjgktwwr52"
},
"path": "/t/free-like-data-structure/14012#post_8",
"publishedAt": "2026-05-01T15:55:41.000Z",
"site": "https://discourse.haskell.org",
"textContent": "ashokkimmel:\n\n>\n> data Traversal' a b x t\n> = End x t\n> | Step (Traversal' a b (a,x) (b -> t)) deriving Functor\n>\n\nThe way I thought of it was this.\n\n\n data Free0 f a = Pure0 a | Free0 (Free0 f (f a)) -- Original Free\n data Free1 g f a = Pure1 (g a) | Free1 (Free1 g f (f a)) -- Compose with another functor\n data Free2 g f f' a a' = Pure2 (g a a') | Free2 (Free2 g f f' (f a) (f' a')) -- Add another type parameter\n type Traversal' a b x t = Free2 (,) ((,) a) ((->) b) x t\n\n\nI thought `Free2` and `Free` were very similar, and the `Traversal'` defined above could be implemented as a special case of `Free2`.",
"title": "Free-like data structure:"
}