I found that I can do this 1 :: Product Int and get Product {getProduct = 1} as a result.
Product is newtype defined in Data.Monoid . Then I tried to define my own newtype as follows:
newtype Stuff a = Stuff {getStuff :: a} deriving (Show)
But if I try to make 1 :: Stuff Int , I get an error:
<interactive>:20:1: error: * No instance for (Num (Stuff Int)) arising from the literal `1' * In the expression: 1 :: Stuff Int In an equation for `it': it = 1 :: Stuff Int
Should I put a Num restriction on a or something else? Why is this not working?
source share