Does anyone here know how to write a callback function in #Haskell for the #Gtk file dialog? I am totally lost.

Follow

@user8e8f87c

Since `type AsyncReadyCallback = GObject -> AsyncResult -> IO () ` (found via hoogle) and it is wrapped in maybe, you shall pass

```
(Just $ \obj res -> pure ())
```

Replace `pure ()` with what you need to do with the object and result. It shoule have the type `IO ()`.

@dpwiz Thank you!

Now I only need to figure out why the whole application crashes when I cancel the file dialog.

@dpwiz I couldn’t find the type of `AsyncReadyCallback`. I forgot about hoogle; so thanks for the reminder. I never did any real project with Haskell just played around with it and some small function for generating LaTeX.

It is really nice that there is a small but very advanced and helpful Haskell community!

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.