这不是我的代码:
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 IDE中运行它:http://www.haskell.org/platform/
但WinGhci只提供类似repl的结构?如何将其加载为haskell文件并运行它?
答案 0 :(得分:1)
将其保存到文件,然后
File -> Load
就是这样,之后你可以拨打main