I'm having trouble understanding why I am getting a type mismatch here. Any assistance would be appreciated.
# Effect.commandStatus defined like so
commandStatus : Str -> Effect (Result I32 {})
## Execute command and return status code if the command returns non-zero code
status : Command -> Task {} I32
status = \ @Command { program } ->
Effect.commandStatus program
|> InternalTask.fromEffect
── TYPE MISMATCH ───────────────────────────────── examples/../src/Command.roc ─
Something is off with the body of the status definition:
46│ status : Command -> Task {} I32
47│ status = \ @Command { program } ->
48│> Effect.commandStatus program
49│> |> InternalTask.fromEffect
This InternalTask.fromEffect call produces:
InternalTask.Task I32 {}
But the type annotation on status says it should be:
Task.Task {} I32
Tip: Type comparisons between an opaque type are only ever equal if
both types are the same opaque type. Did you mean to create an opaque
type by wrapping it? If I have an opaque type Age := U32 I can create
an instance of this opaque type by doing @Age 23.
────────────────────────────────────────────────────────────────────────────────
Actually, figured it out. Order of the result in commandStatus
was wrong. Didn't see until after posting here.
Luke Boswell has marked this topic as resolved.
Last updated: Jul 06 2025 at 12:14 UTC