Just started learning Haskell! Currently watching this particular video: https://youtu.be/vhsONvQc-Dc?list=PLmTgnNwroyn8TnF26YRvW-hvQF1ypztzg in the seies. I copied his code verbatim, but keep getting errors running the code on my antiX-23.2 Linux box using a fresh Haskell install. [quote] main = do let testScores = [79,85,92,56] print (testScores !! 0) -- !! means index-of print (testScores !! 3) -- last item print (head testScores) -- returns first item in a list [/quote] [quote] runghc "hello.hs" (in directory: /home/dnormandin/Programming/haskell/code) hello.hs:1:8: error: [GHC-52095] Unexpected do block in function application: do let testScores = ... Suggested fixes: • Use parentheses. • Perhaps you intended to use BlockArguments You may enable this language extension in GHCi with: :set -XBlockArguments | 1 | main = do | ^^... Compilation failed. [/quote] I can't figure out what's wrong with the code. I _think_ that the indenting is ok - which BTW is a bloody PITA!! I have some cl/scheme experience, but mostly with procedural langs. Maybe the tutorial is too dated to be useful? If it is, is there a similar video tutorial for beginners? TIA ... -- Duke
It looks like the problem is the indentation, I would expect the let and
the print statements to have the same level of indentation (since there’s
no “in” with the “let”)
On Wed, Dec 17, 2025 at 20:44 Duke Normandin
Just started learning Haskell! Currently watching this particular video: https://youtu.be/vhsONvQc-Dc?list=PLmTgnNwroyn8TnF26YRvW-hvQF1ypztzg
in the seies. I copied his code verbatim, but keep getting errors running the code on my antiX-23.2 Linux box using a fresh Haskell install.
[quote] main = do let testScores = [79,85,92,56] print (testScores !! 0) -- !! means index-of print (testScores !! 3) -- last item print (head testScores) -- returns first item in a list [/quote]
[quote] runghc "hello.hs" (in directory: /home/dnormandin/Programming/haskell/code) hello.hs:1:8: error: [GHC-52095] Unexpected do block in function application: do let testScores = ... Suggested fixes: • Use parentheses. • Perhaps you intended to use BlockArguments You may enable this language extension in GHCi with: :set -XBlockArguments | 1 | main = do | ^^... Compilation failed. [/quote]
I can't figure out what's wrong with the code. I _think_ that the indenting is ok - which BTW is a bloody PITA!! I have some cl/scheme experience, but mostly with procedural langs. Maybe the tutorial is too dated to be useful? If it is, is there a similar video tutorial for beginners? TIA ... -- Duke _______________________________________________ Beginners mailing list -- beginners@haskell.org To unsubscribe send an email to beginners-leave@haskell.org
Thx! I believe that indenting bs just killed my exploration of haskell. Much obliged…. — Duke Sent from my iPhone
On Dec 18, 2025, at 12:14 AM, Bob Ippolito
wrote: It looks like the problem is the indentation, I would expect the let and the print statements to have the same level of indentation (since there’s no “in” with the “let”)
On Wed, Dec 17, 2025 at 20:44 Duke Normandin
wrote: Just started learning Haskell! Currently watching this particular video: https://youtu.be/vhsONvQc-Dc?list=PLmTgnNwroyn8TnF26YRvW-hvQF1ypztzg in the seies. I copied his code verbatim, but keep getting errors running the code on my antiX-23.2 Linux box using a fresh Haskell install.
[quote] main = do let testScores = [79,85,92,56] print (testScores !! 0) -- !! means index-of print (testScores !! 3) -- last item print (head testScores) -- returns first item in a list [/quote]
[quote] runghc "hello.hs" (in directory: /home/dnormandin/Programming/haskell/code) hello.hs:1:8: error: [GHC-52095] Unexpected do block in function application: do let testScores = ... Suggested fixes: • Use parentheses. • Perhaps you intended to use BlockArguments You may enable this language extension in GHCi with: :set -XBlockArguments | 1 | main = do | ^^... Compilation failed. [/quote]
I can't figure out what's wrong with the code. I _think_ that the indenting is ok - which BTW is a bloody PITA!! I have some cl/scheme experience, but mostly with procedural langs. Maybe the tutorial is too dated to be useful? If it is, is there a similar video tutorial for beginners? TIA ... -- Duke _______________________________________________ Beginners mailing list -- beginners@haskell.org To unsubscribe send an email to beginners-leave@haskell.org
Beginners mailing list -- beginners@haskell.org To unsubscribe send an email to beginners-leave@haskell.org
participants (2)
-
Bob Ippolito -
Duke Normandin