on develop help sign in
Add 'FunctorMaybe Option' instance
commite6daabaedf85710138361c01d0e505c854132e50 authorAlexandre Esteves <alexandre.fmp.esteves@gmail.com> dateSat 9 Feb 2019, 18:04 (8 years ago) parent3605d50
1 file changed+9
src/Reflex/FunctorMaybe.hs+9
src/Reflex/FunctorMaybe.hs+9
@@ -1,3 +1,7 @@
1+{-# LANGUAGE CPP #-}
2+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3+{-# LANGUAGE StandaloneDeriving #-}
4+
15-- | This module defines the FunctorMaybe class, which extends Functors with the
26-- ability to delete values.
37module Reflex.FunctorMaybe
@@ -9,6 +13,7 @@ import qualified Data.IntMap as IntMap
913import Data.Map (Map)
1014import qualified Data.Map as Map
1115import Data.Maybe
16+import Data.Semigroup (Option(..))
1217
1318--TODO: See if there's a better class in the standard libraries already
1419
@@ -32,6 +37,10 @@ class FunctorMaybe f where
3237instance FunctorMaybe Maybe where
3338 fmapMaybe = (=<<)
3439
40+#if MIN_VERSION_base(4,9,0)
41+deriving instance FunctorMaybe Option
42+#endif
43+
3544-- | @fmapMaybe = mapMaybe@
3645instance FunctorMaybe [] where
3746 fmapMaybe = mapMaybe