Skip to content

Commit

Permalink
Add Disposable instance for Maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
queezle42 committed Aug 11, 2024
1 parent 86af67c commit ddbae29
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions quasar/src/Quasar/Disposer/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class Disposable a where
instance Disposable (Disposer, a) where
getDisposer (disposer, _) = disposer

instance Disposable a => Disposable (Maybe a) where
getDisposer Nothing = mempty
getDisposer (Just x) = getDisposer x


isDisposed :: Disposable a => a -> Future '[] ()
isDisposed r = toFuture (getDisposer r)
Expand Down

0 comments on commit ddbae29

Please sign in to comment.