Closed dmvianna closed 6 years ago
When you say "and nothing more", do you mean that the tests hang indefinitely, or do they complete without providing any errors?
Have you tried introducing something you know would fail the tests so you can see what might happen?
Yes, it hangs indefinitely as if it were running the app. You can check my code. No, I didn't introduce anything to make it fail (although it does until I remove the error
statements such as)
error "Copy your completed 'app' from the previous level and refactor it here"
You still have undefined
in https://github.com/dmvianna/applied-fp-course/blob/dmvianna/src/Level06/Core.hs#L61 so even when you fix issue the tests will still fail.
The issue arises from your MonadIO
instance for AppM
, you are using liftIO
to try to lift a function from IO
to AppM
, when that is the function you are actually trying to implement. You do not need to use liftIO
in this definition, look again the types you are working with:
You start with:
IO a
You want:
AppM a
The constructor for AppM
requires:
IO (Either Error a)
So if you start your implementation with something like:
liftIO :: IO a -> AppM a
liftIO ioa = AppM (_F ioa)
That type hole _F
will tell GHC to give you some more information about what is required, you should be able to then follow the types to arrive at a solution.
I would also suggest, that for each of these typeclasses, comment out your current solution and then try to reimplement them using only functions from that typeclass.
You don't need Monad
or MonadIO
to write the Functor
instance, for example.
Thank you @mankyKitty! All sorted. I really needed a refresher on writing sane instances! What got into my head!
What's the next challenge from qfpl? Reflex?
That, and so much more. ;)
I have now completed the exercises in this repo (at least they compile...). However Since very early in the Levels, running
cabal new-test test-suite:app-fp-tests
withinnix-shell
(nixos) gives meand nothing more. Uncommenting each Level separately doesn't change that behaviour.
With
cabal test test-suite:app-fp-tests
I get insteadand finally, with
cabal test app-fp-tests
andcabal new-test app-fp-tests
I get the same behaviour as withcabal new-test
.Notice that this happens only when I complete each Level. I get proper error messages before completing a level.