fork download
  1. import qualified Data.Foldable as F
  2. import Control.Monad
  3. import Control.Monad.Instances
  4.  
  5. monkeyNum :: Integer -> Integer
  6. monkeyNum = F.foldMap ((^ 5) . read . (:[])) . show
  7.  
  8. isMonkey :: Integer -> Bool
  9. isMonkey = monkeyNum >>= (==)
  10.  
  11. main :: IO ()
  12. main = print $ sum $ filter isMonkey [10..99999]
  13.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
[1 of 1] Compiling Main             ( prog.hs, prog.o )

prog.hs:6:12:
    No instance for (Data.Monoid.Monoid Integer)
      arising from a use of `F.foldMap' at prog.hs:6:12-43
    Possible fix:
      add an instance declaration for (Data.Monoid.Monoid Integer)
    In the first argument of `(.)', namely
        `F.foldMap ((^ 5) . read . (: []))'
    In the expression: F.foldMap ((^ 5) . read . (: [])) . show
    In the definition of `monkeyNum':
        monkeyNum = F.foldMap ((^ 5) . read . (: [])) . show
stdout
Standard output is empty