Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No output of tuples in raw mode #13

Closed
jwoLondon opened this issue Dec 13, 2018 · 3 comments
Closed

No output of tuples in raw mode #13

jwoLondon opened this issue Dec 13, 2018 · 3 comments
Labels
bug Something isn't working priority/p2

Comments

@jwoLondon
Copy link
Member

jwoLondon commented Dec 13, 2018

See also related issue #14

Just so we have a record of it, currently, when setting a code block to raw / r, tuples are not displayed.

Minimal working example:

```elm {r}
tupleTest : ( Int, Int )
tupleTest =
    ( 99, 50 )
```

Should display (99,50) but nothing is displayed, nor is any warning generated.

The same problem occurs with a list of tuples:

```elm {r}
tupleListTest : List ( Int, Int )
tupleListTest =
    [ ( 1, 2 ), ( 3, 4 ) ]
```

Interestingly, if a tuple or list of tuples is embedded inside a record, it is displayed correctly, which may help to diagnose the cause of the problem:

```elm {r}
type alias MyRecord =
    { intItem : Int
    , strItem : String
    , booItem : Bool
    , lstItem : List Int
    , tplItem : ( Int, Int )
    , tp3Item : ( Bool, Int, String )
    , tLsItem : List ( Int, Int )
    , rcdItem : { nestedName : String, nestedValue : Int }
    }


recordTest : MyRecord
recordTest =
    MyRecord 1 "two" True [ 3, 4, 5 ] ( 6, 7 ) ( False, 8, "nine" ) [ ( 10, 11 ), ( 12, 13 ) ] { nestedName = "fourteen", nestedValue = 15 }
```

Generated the following (correct) raw output:

{ booItem = True, intItem = 1, lstItem = [3,4,5], rcdItem = { nestedName = "fourteen", nestedValue = 15 }, strItem = "two", tLsItem = [(10,11),(12,13)], tp3Item = (False,8,"nine"), tplItem = (6,7) }[(1,2),(3,4)]

@kachkaev
Copy link
Member

kachkaev commented Dec 17, 2018

This is likely a duplicate of #14. Our current regexp is too strict for tupleTest : ( Int, Int ) and alike. I'll keep the issue open until I fix #14 and verify that your example works.

@jwoLondon
Copy link
Member Author

In case it helps with the regexp, tuples can have only two or three elements as of Elm 0.19. 4-tuples or longer are no longer permitted.

@kachkaev
Copy link
Member

kachkaev commented Dec 20, 2018

Your examples above worked for me locally after I fixed #14 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority/p2
Projects
None yet
Development

No branches or pull requests

2 participants