这不是我的代码:
import Data.Monoid (Endo (..), appEndo)
import Data.Foldable (foldMap)
-- | chainEndos chain a list of endomorphisms to create a new one
-- Point-free version is feasible and redable.
-- Level: Easy
--
-- Examples:
--
-- >>> chainEndos [(+1),(*3)] 2
-- 7
-- >>> chainEndos [('h':),('e':)] "llo"
-- "hello"
--
-- >>> chainEndos [] (12 :: Int)
-- 12
--
chainEndos :: [a->a] -> a -> a
chainEndos = appEndo . foldMap Endo
chainEndos' :: [a->a] -> a -> a
chainEndos' = foldr (.) id
main = print $ chainEndos [('h':),('e':)] "llo"我想在Haskell:http://www.haskell.org/platform/中运行这个
但是WinGhci仅仅提供了一个类似于爬行的结构?如何将此文件作为haskell文件加载并运行?
发布于 2014-03-06 05:04:46
然后把它保存到文件中
File -> Load
仅此而已,之后你可以打电话给main
https://stackoverflow.com/questions/22210394
复制相似问题