on master help sign in
Follow HLint suggestions.
50cba00Sam Bickley
src/lib/ProjectM36/Tupleable.hs+1−1
@@ -178,7 +178,7 @@ class Tupleable a where
178 toAttributes = genericToAttributes defaultTupleableOptions
178 toAttributes = genericToAttributes defaultTupleableOptions
179
179
180-- | Options that influence deriving behavior.
180-- | Options that influence deriving behavior.
181−data TupleableOptions = TupleableOptions {
181+newtype TupleableOptions = TupleableOptions {
182 -- | A function that translates record field names into attribute names.
182 -- | A function that translates record field names into attribute names.
183 fieldModifier :: T.Text -> T.Text
183 fieldModifier :: T.Text -> T.Text
184 }
184 }
src/lib/ProjectM36/Tupleable/Deriving.hs+3−2
@@ -56,6 +56,7 @@ module ProjectM36.Tupleable.Deriving
56import Data.Proxy
56import Data.Proxy
57import qualified Data.Text as T
57import qualified Data.Text as T
58import Data.Text.Manipulate
58import Data.Text.Manipulate
59+import Data.Maybe
59import GHC.TypeLits
60import GHC.TypeLits
60import GHC.Generics (Generic, Rep)
61import GHC.Generics (Generic, Rep)
61import ProjectM36.Tupleable
62import ProjectM36.Tupleable
@@ -128,7 +129,7 @@ instance KnownSymbol prefix => ModifyText (AddPrefix prefix) where
128data DropPrefix (prefix :: Symbol)
129data DropPrefix (prefix :: Symbol)
129
130
130instance KnownSymbol prefix => ModifyText (DropPrefix prefix) where
131instance KnownSymbol prefix => ModifyText (DropPrefix prefix) where
131− modifyText _ oldText = maybe oldText id (T.stripPrefix prefixText oldText)
132+ modifyText _ oldText = fromMaybe oldText (T.stripPrefix prefixText oldText)
132 where
133 where
133 prefixText = T.pack (symbolVal (Proxy :: Proxy prefix))
134 prefixText = T.pack (symbolVal (Proxy :: Proxy prefix))
134
135
@@ -144,7 +145,7 @@ instance KnownSymbol suffix => ModifyText (AddSuffix suffix) where
144data DropSuffix (suffix :: Symbol)
145data DropSuffix (suffix :: Symbol)
145
146
146instance KnownSymbol suffix => ModifyText (DropSuffix suffix) where
147instance KnownSymbol suffix => ModifyText (DropSuffix suffix) where
147− modifyText _ oldText = maybe oldText id (T.stripSuffix suffixText oldText)
148+ modifyText _ oldText = fromMaybe oldText (T.stripSuffix suffixText oldText)
148 where
149 where
149 suffixText = T.pack (symbolVal (Proxy :: Proxy suffix))
150 suffixText = T.pack (symbolVal (Proxy :: Proxy suffix))
150
151