moocfi / haskell-mooc

Haskell MOOC University of Helsinki
Other
313 stars 446 forks source link

Submission fails with factory code #92

Closed asarkar closed 11 months ago

asarkar commented 11 months ago

Set13b has the following:

-- Write a log message
msgSL :: String -> SL ()
msgSL msg = SL ((),,[msg])

When submitted, this fails with "Illegal tuple section" error.

Exercise set: Set13b.hs

Submission time: 2023-12-01 04:08:30

Submission status: READY

Error report:

Set13b.hs:337:16: error: Illegal tuple section: use TupleSections
    |
337 | msgSL msg = SL ((),,[msg])
    |                ^^^^^^^^^^^

Set13b.hs:365:17: error: Illegal tuple section: use TupleSections
    |
365 |   return a = SL (a,,[])
    |                 ^^^^^^^

The second error comes from the code I wrote, but the first error is due to OOTB code.

This can be easily fixed by adding {-# LANGUAGE TupleSections #-} at the top of the file, but there is a clear disconnect between the code and the assessment server.

opqdonut commented 11 months ago

I think you've accidentally edited the file. Perhaps your IDE suggests tuple sections? The code in the exercise template doesn't use tuple sections:

https://github.com/moocfi/haskell-mooc/blob/18a2f58698de70bca8db2e324ffeb1510e8c6142/exercises/Set13b.hs#L300-L301

asarkar commented 11 months ago

@opqdonut

The code in the exercise template doesn't use tuple sections

It does.

https://github.com/moocfi/haskell-mooc/blob/ghc-9/exercises/Set13b.hs#L301

It is standard practice to wait for OP to respond to a question before closing the ticket. Please reopen.

opqdonut commented 11 months ago

From your original message

Set13b.hs:337:16: error: Illegal tuple section: use TupleSections
    |
337 | msgSL msg = SL ((),,[msg])
    |                ^^^^^^^^^^^

From the source we both linked to:

msgSL msg = SL (\s -> ((),s,[msg])) 

Note the difference: ((),,[msg]) vs (\s -> ((),s,[msg])).

Sorry about closing the ticket, I didn't realise it was important to you to keep it open. Reopened.

asarkar commented 11 months ago

@opqdonut Weird, I don’t remember changing the given code. I run hlint and ormolu on the code base, and am guessing the change came from one of those. Sorry for the confusion and thank you for supporting this excellent course.