You were probably confusing it with a type alias, which is often used with
records, right?
On Monday, September 5, 2016 at 9:28:49 PM UTC-5, Luis Fei wrote:
>
> Oh, it's just union types, got it, thank you, Janis
>
> On Monday, September 5, 2016 at 7:02:13 PM UTC+8, Janis Voigtländer wrote:
>>
>> Would you have been more comfortable if the definition would have been
>> like the following?
>>
>> type Config data msg =
>> ConfigConstructor
>> { toId : data -> String
>> , toMsg : State -> msg
>> , columns : List (ColumnData data msg)
>> , customizations : Customizations data msg
>> }
>>
>> If yes, then the only additional thing you need to know is that it is
>> just fine to use the name Config in both the places of Config and
>> ConfigConstructor here, because these two entities live in two different
>> name spaces, so the compiler can never be confused by them.
>>
>> If not, if the above definition would not be clear to you either, then
>> you probably need to read (more) about union types. The guide is
>> recommended, specifically the above is like the example
>> http://guide.elm-lang.org/types/union_types.html#anonymous-users, where
>> Config is like User in that example and ConfigConstructor is like Named
>> in that example.
>>
>>
>> 2016-09-05 12:22 GMT+02:00 Luis Fei <[email protected]>:
>>
>>> Hello, I just tried to look into elm-sortable-table's source code, and
>>> this `Config` type got me confused
>>>
>>>
>>> https://github.com/evancz/elm-sortable-table/blob/master/src/Table.elm#L96-L102
>>>
>>> I'll paste it here for convenience
>>>
>>> type Config data msg =
>>> Config
>>> { toId : data -> String
>>> , toMsg : State -> msg
>>> , columns : List (ColumnData data msg)
>>> , customizations : Customizations data msg
>>> }
>>>
>>> How this type works? Is the inner Config called like a function? What's
>>> related between two Config? And so on...
>>>
>>> Hope someone can explain it a bit, thanks
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Elm Discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.