Haskell ExtendedDefaultRules. Changing default values?

I am working with mongodb and create many bson types like this.

[ "group"  =: "default" , "views" =: 0 ]

      

Specifying the exact types becomes very annoying. I have to build it this way if it cannot be subtracted.

[ "group"  =: ("default" :: Text) , "views" =: (1 :: Int) ]

      

Therefore, providing a pragma {-# LANGUAGE ExtendedDefaultRules #-}

fixes it, but is not the desired types. The default is Integer, which is not good for performance and for String, which is not good for consistency.

Is it possible to change the default and make it the default to say Int and Text without manually defining the types every time?

Thank.

+3


source to share


1 answer


With OverloadedStrings, you can use default (Int, Text)



+1


source







All Articles