How to write Semigroup instance for this data type?

前端 未结 2 1199
野性不改
野性不改 2021-01-06 07:21

I\'m trying to do one of the Semigroup exercises in Haskell Book (Chapter 15, \"Monoid, Semigroup\") but I\'m stuck. The following is given:

newtype Combine          


        
2条回答
  •  情歌与酒
    2021-01-06 08:04

    You can shadow Monoid's (<>) this way:

    import Data.Monoid hiding ((<>))
    

    Then when you import Data.Semigroup, you will have just one (<>) in scope: the one from Data.Semigroup.

提交回复
热议问题