我有一个项目,我们正在提高在 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