{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreibkgvrqju2xtfjhbw5orzft7emwzrdggw7oofu7g7aj77ycae7jnm",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mkqfpar33cm2"
},
"path": "/t/free-like-data-structure/14012#post_1",
"publishedAt": "2026-04-30T19:44:43.000Z",
"site": "https://discourse.haskell.org",
"textContent": "\n data Free f a\n = Pure a\n | Free (Free f (f a)) deriving Functor\n -- f (a -> b) -> a -> f b\n (??) :: Functor f => f (a -> b) -> a -> f b\n fab ?? a = fmap ($ a) fab -- Copied fro Control.Lens\n instance Functor f => Applicative (Free f) where\n pure = Pure\n Pure g <*> x = g <$> x\n Free g <*> x = Free $ (flip (fmap . flip id) <$> g) <*> x\n\n\nThis is similar to the Free monad, but reversed. Is it the free `Applicative` or something? It seems similar to one of the proposals of `bound`.",
"title": "Free-like data structure:"
}