@@ -7,9 +7,11 @@ module LambdaBuffers.Compiler.ProtoCompat.InfoLess (
77 withInfoLess ,
88 withInfoLessF ,
99 mkInfoLess ,
10- InfoLessC ,
10+ InfoLessC ( infoLessId ) ,
1111) where
1212
13+ import Control.Monad (join )
14+ import Control.Monad.Identity (Identity (Identity ))
1315import Data.Bifunctor (Bifunctor (bimap ))
1416import Data.Default (Default (def ))
1517import Data.Map qualified as M
@@ -66,6 +68,8 @@ import LambdaBuffers.Compiler.ProtoCompat.Types (
6668newtype InfoLess a = InfoLess { unsafeInfoLess :: a }
6769 deriving stock (Show , Eq , Ord )
6870 deriving stock (Functor , Traversable , Foldable )
71+ deriving (Applicative ) via Identity
72+ deriving (Monad ) via Identity
6973
7074{- | SourceInfo Less ID.
7175 A TypeClass that provides id for types with SourceInfo - where SI is defaulted - therefore ignored. Can only be derived.
@@ -90,6 +94,9 @@ withInfoLess (InfoLess a) f = f . unsafeInfoLess . mkInfoLess $ a
9094withInfoLessF :: forall f {a } {b }. InfoLessC a => InfoLess a -> (a -> f b ) -> f b
9195withInfoLessF (InfoLess a) f = f . unsafeInfoLess . mkInfoLess $ a
9296
97+ instance InfoLessC a => InfoLessC (InfoLess a ) where
98+ infoLessId = join . mkInfoLess
99+
93100instance InfoLessC a => InfoLessC [a ] where
94101 infoLessId = fmap infoLessId
95102
0 commit comments