import Data.Foldableimport Control.Monadimport Control.Monad.Instances monkeyNum :: Integer -> IntegermonkeyNum = foldMap ((^ 5) . read . (:[])) . show isMonkey :: Integer -> BoolisMonkey = monkeyNum >>= (==) main :: IO ()main = print $ sum $ filter isMonkey [10..99999]
Standard input is empty
[1 of 1] Compiling Main ( prog.hs, prog.o ) prog.hs:12:15: Ambiguous occurrence `sum' It could refer to either `Prelude.sum', imported from Prelude or `Data.Foldable.sum', imported from Data.Foldable at prog.hs:1:0-19
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!