It’s some form of compiler bug. If in your gist, you replace the output
type HasX a by { a | x : Float }, which is its definition, then the gist
will suddenly compile. So I think you should try to bring this example down
to a minimal case and then open a bug report at
https://github.com/elm-lang/elm-compiler/issues (after you have checked
there isn’t an issue covering this alreay).
About some of your specific questions:
- how HasX (HasXAndY {}) and HasXAndY (Has X a) could behave differently
They are different types. The first one is a record type that contains two
(!) fields x (of which only one is accessible) and one field y. The second
one is a record type that contains those two/three plus whatever fields the
record type has to which a will be instantiated.
- what the error message is trying to say; what is the difference
between HasX { …, x : … } and HasX {…}
It’s trying to say that the first of these types has an x field that the
second of these types does not have. Likely a consequence of the double
presence of x (see above) in one of the two types. Like: HasX { ..., x :
... } has two xs, but HasX {...} has only one.
2016-08-24 6:47 GMT+02:00 Thomas Ballinger <[email protected]>:
> I thought I'd bump this, I'd appreciate a pointer of something to read or
> an example that might clarify things.
>
> On Friday, August 19, 2016 at 12:43:13 PM UTC-4, Thomas Ballinger wrote:
>>
>> I can see experimentally this is the case, but would someone mind
>> spelling this out a bit for me? I think I don't understand
>> * why the order of lines 55/56 matter
>> * how HasX (HasXAndY {}) and HasXAndY (Has X a) could behave differently
>> * what the error message is trying to say; what is the difference between
>> HasX { ..., x : ... } and HasX {...}
>> but those may be the wrong questions.
>>
>> On Thursday, August 18, 2016 at 11:44:26 PM UTC-4, John Bugner wrote:
>>>
>>> >While adding type annotations I encountered something I didn't
>>> understand that I worked around at https://github.com/thomasba
>>> llinger/loveinthetimeoftetris/blob/3f968afad490ebab54b4f0c3b
>>> afdf45b779ebc4b/src/Main.elm#L278
>>> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fthomasballinger%2Floveinthetimeoftetris%2Fblob%2F3f968afad490ebab54b4f0c3bafdf45b779ebc4b%2Fsrc%2FMain.elm%23L278&sa=D&sntz=1&usg=AFQjCNHWWle8K9N4ns0hPN_ZsfHuLhyhMA>,
>>> I tried to simplify the behavior and got it down to this
>>> https://gist.github.com/thomasballinger/a0d8b38fa7186ee2e608d4772f2ebe7e
>>> <https://www.google.com/url?q=https%3A%2F%2Fgist.github.com%2Fthomasballinger%2Fa0d8b38fa7186ee2e608d4772f2ebe7e&sa=D&sntz=1&usg=AFQjCNGqGdcDpNNLJcdHYuk4QmwUE0kuzA>
>>> which
>>> I'd appreciate a hand from anyone in understanding.
>>> I haven't used extensible records very much, but I think it's because
>>> the signatures don't match.
>>> The first is:
>>> >hasBothXAndY : HasXAndY (HasX a)
>>> but the other is:
>>> >fieldOfBothTypes : HasX (HasXAndY {})
>>> The order matters.
>>>
>>> (Btw, the (<|) function is the opposite of (|>). I personally use only
>>> the former, because it does things in the same order that you normally
>>> write a function. The latter makes things look "backwards".)
>>>
>>> On Thursday, August 18, 2016 at 7:06:13 PM UTC-5, Thomas Ballinger wrote:
>>>>
>>>> Thanks very much John. The auto-formatter I'm using is
>>>> https://github.com/avh4/elm-format, I also found it to be a bit much.
>>>> I'm a big fan of automatic formatting so might look at changing these
>>>> settings in elm-format, or if anyone knows of other autoformatters please
>>>> let me know.
>>>>
>>>> While adding type annotations I encountered something I didn't
>>>> understand that I worked around at https://github.com/thomasba
>>>> llinger/loveinthetimeoftetris/blob/3f968afad490ebab54b4f0c3b
>>>> afdf45b779ebc4b/src/Main.elm#L278, I tried to simplify the behavior
>>>> and got it down to this https://gist.github.com/thomas
>>>> ballinger/a0d8b38fa7186ee2e608d4772f2ebe7e which I'd appreciate a hand
>>>> from anyone in understanding.
>>>>
>>>> I did the rest of these except for switching to SVG, but I'm looking
>>>> forward to that too.
>>>>
>>>>
>>>>> >* I don't think I'll be using evancz/elm-graphics in the future since
>>>>> I'll be doing less gamey stuff or want to work with canvas more directly.
>>>>> How is this usually done?
>>>>> By using Svg instead: http://package.elm-la
>>>>> ng.org/packages/elm-lang/svg/1.1.1
>>>>>
>>>>> On Wednesday, August 17, 2016 at 4:40:38 PM UTC-5, Thomas Ballinger
>>>>> wrote:
>>>>>>
>>>>>> Hi Elm folks! I've enjoyed reading this list for a bit. I've written
>>>>>> my first Elm thing over the last couple weeks and would love to hear any
>>>>>> kind of feedback on it. It's an unfinished game jam piece I kept running
>>>>>> with so the title doesn't make sense.
>>>>>>
>>>>>> code: https://github.com/thomasballinger/loveinthetimeoftetris
>>>>>> live: love.ballingt.com (takes about 70 seconds to play all of)
>>>>>>
>>>>>> I was going to clean things up the way I know how, but I need to take
>>>>>> a break to get some other things done and I thought I'd learn more by
>>>>>> asking how someone else might clean it up. Please don't assume I know
>>>>>> what
>>>>>> I'm doing in the slightest :)
>>>>>>
>>>>>> Any feedback would be great, but if prompts are helpful:
>>>>>> * what does this code make it look like I'm missing about Elm?
>>>>>> * what do you think of the extensible record type aliases? I think
>>>>>> the way I've used them is mostly terrible, I designed them up front
>>>>>> instead
>>>>>> of letting them evolve.
>>>>>> * code style?
>>>>>> * I'm using an elm autoformatter, how's my formatting? Is this style
>>>>>> common?
>>>>>> * I don't think I'll be using evancz/elm-graphics in the future since
>>>>>> I'll be doing less gamey stuff or want to work with canvas more directly.
>>>>>> How is this usually done?
>>>>>> * I abandoned elm reactor once I started embedding in html, is that a
>>>>>> viable workflow I should have stuck with for longer?
>>>>>> * I was tempted to start a utils file or look for an external lib but
>>>>>> was trying to focus on learning the stdlib. Are there pretty common util
>>>>>> libs folks use? I sure missed some list functions.
>>>>>> * I escaped to JavaScript anytime I thought it would be hard to do
>>>>>> something with the stdlib, presumably it would be nice to use Elm for
>>>>>> some
>>>>>> of these things?
>>>>>>
>>>>>> Thanks so much, and feel free to contact off list if you prefer at
>>>>>> [email protected] - if you do I'll report back what I learned to the
>>>>>> list.
>>>>>>
>>>>> --
> 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.