Help with Maybe Instant

Hello
I’ve run into an issue with Maybe Instant and there must be something I am doing wrong. However I have very little experience with both Purescript and functional programming in general (about 5 months). Below is the code block that is giving me issues:

let time = if runFn1 isDone unit then do
              case instant (runFn1 offsetTime (unInstant t)) of
                Just m → m
                Nothing → t
            else
              t

If I remove the case statement it gets angry that there is an unhandled maybe so I know that I have a maybe. So I surround it with the case of and handle the two possible outcomes. However I now have an error that states:

Unknown data constructor Just

I have used case statements for this very purpose elsewhere in the code but for some reason it does not work here. What am I doing wrong?

1 Like

From looking at the error, perhaps you should import Data.Maybe (Maybe(..))?

1 Like

Yep that was it. I had Data.Maybe (Maybe) instead. Thanks so much

1 Like