typelead / eta

The Eta Programming Language, a dialect of Haskell on the JVM
https://eta-lang.org
BSD 3-Clause "New" or "Revised" License
2.61k stars 141 forks source link

[eta-tour]: Missing info RecordWildCards #819

Open nomisRev opened 6 years ago

nomisRev commented 6 years ago

Source Code:

data Pair = Pair { pairX :: Int
                 , pairY :: Int }

myPair :: Pair
myPair = Pair { pairX = 1
              , pairY = 2 }

pairToString :: Pair -> String
pairToString Pair { pairX = x, pairY = y } =
  "("    show x   
  ","    show y    ")" 

main :: IO ()
main = putStrLn $ "myPair = "    pairToString myPair

Output:

Illegal `..' in record 
Use RecordWildCards to permit this

Dear Eta team,

First of all, I want to thank you for the awesome documentation! 👏 And on the amazing work, you guys are doing.

I am brand new to Eta or Haskell and couldn't compile the snippet locally because it was missing {-# LANGUAGE RecordWildCards #-}. I had no idea yet how to enable special compiler features and thought it would'be useful to add it to the page.

Cheers!

EDIT: Same with

Jyothsnasrinivas commented 6 years ago

@nomisRev Thanks! We are actually going to enable many of those features by default in Eta v1.0. In the next iteration of the tour/docs we'll mention how to deal with Language Pragmas.

nomisRev commented 6 years ago

@Jyothsnasrinivas Thanks for the response :) Very happy to hear many of these features will be enabled by default!