pending test for #528

This commit is contained in:
Paul Chiusano 2019-06-28 11:41:32 -04:00
parent d4da8afbb0
commit 173aad36d3

View File

@ -0,0 +1,36 @@
-- needs Base.u
use Trie tail head
type Trie k v = { head : Optional v, tail : Map k (Trie k v) }
Trie.empty = Trie None Map.empty
Trie.toList : Trie k v -> [([k], v)]
Trie.toList t =
go : [k] -> Trie k v -> [([k], v)]
go path t =
here = case Trie.head t of
Optional.None -> []
Optional.Some v -> [(path, v)]
tail t |> Map.toList
|> List.map (p -> go (path `snoc` at1 p) (at2 p))
|> List.join
|> (List.++) here
go [] t
> toList Trie.empty
---
bombs with:
💔💥
I stopped evaluation after encountering an error:
user error (type error, expecting List, got: (Lam 1 FormClosure 5MQKGmyVUfJMTmaGyk8TBmLJMoZbUKGDE4fgKBhAMzMkmwpweM7gsPPUivFuY4PeMM1Qrt7e2RnAs2sw4QJzsqjJ Ref(##List.++) [[]] (Leaf External:ExternalFunction)))
I'm sorry this message doesn't have more detail
about the location of the failure. My makers plan to
fix this in a future release. 😢