Stream: beginners

Topic: What is this type?


view this post on Zulip itmuckel (Apr 01 2023 at 21:26):

From the docs:

expect
    Dict.single 1 "One"
    |> Dict.insert 2 "Two"
    |> Dict.insert 3 "Three"
    |> Dict.insert 4 "Four"
    |> Bool.isEq (Dict.fromList [T 1 "One", T 2 "Two", T 3 "Three", T 4 "Four"])

What is T doing in the list? Is it a specific type?

view this post on Zulip Brendan Hansknecht (Apr 01 2023 at 21:50):

Is an anonymous tag with one type. T, short for Tuple

view this post on Zulip Brendan Hansknecht (Apr 01 2023 at 21:50):

We should update it to real tuples since they exist now

view this post on Zulip Brendan Hansknecht (Apr 01 2023 at 21:52):

Could be seen as being defined as Tuple k v: [ T k v ]

view this post on Zulip Nick Hallstrom (Apr 01 2023 at 22:11):

Just curious, but is there any difference between using a tuple and a tag other than syntax? Is there anything that tuples can do that a tag can’t?

view this post on Zulip Agus Zubiaga (Apr 01 2023 at 22:14):

Well, you can access its members without destructuring with the tuple.0 syntax

view this post on Zulip Brendan Hansknecht (Apr 01 2023 at 22:18):

Yeah, i think that is the only noticeable difference, so, fundamentally, i would consider them two ways to write the same thing.


Last updated: Jul 06 2025 at 12:14 UTC