小编Gar*_*ary的帖子

Haskell 中的连接以及与 AList 的混淆 ([a] -> [a])

我有一个项目,我们正在提高在 Haskell 中连接列表的速度。我是 Haskell 的新手,对AList ([a] -> [a])特别是如何将我的 AppendedList 转换为常规列表感到困惑 。任何帮助,将不胜感激。

newtype AppendedList a = AList ([a] -> [a])

-- List[5] is represented as AList (\x -> 5:x) 
-- This function takes an argument and returns the AppendedList for that 
single :: a -> AppendedList a
single m = AList (\x -> m : x)


-- converts AppendedList to regular List
toList :: AppendedList a -> [a]
toList = ???
Run Code Online (Sandbox Code Playgroud)

haskell functional-programming list concatenation lambda-calculus

1
推荐指数
1
解决办法
112
查看次数