roc icon indicating copy to clipboard operation
roc copied to clipboard

Type mismatch in some `cli-platform`-based example apps

Open kili-ilo opened this issue 3 years ago • 1 comments

These apps were working a few days ago. Now examples/interactive/echo.roc and examples/interactive/http-get.roc are giving me these kinds of checker errors:

[jan@framey roc]$ roc dev examples/interactive/echo.roc         

── TYPE MISMATCH ─────────────────────────────── examples/interactive/echo.roc ─

This 1st argument to noArgs has an unexpected type:

7│  main = Program.noArgs mainTask
                          ^^^^^^^^

This mainTask value is a:

    (List Str -> Task.Task Program.ExitCode [] [Read [Stdin],
    Write [Stdout]] ?)

But noArgs needs its 1st argument to be:

    InternalTask.Task Program.ExitCode [] * ?

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.

────────────────────────────────────────────────────────────────────────────────

1 error and 0 warnings found in 12 ms.

You can run the program anyway with roc run examples/interactive/echo.roc
[jan@framey roc]$ 

kili-ilo avatar Sep 25 '22 09:09 kili-ilo

Yeah we're using Program.noArgs but then giving it a function that takes List Str (as if it were Program.withArgs instead).

I think the reason this didn't get caught by CI is that these examples aren't included in the interactive/ directory. There are reasonable reasons for why this is currently the case, but we should really make sure those get tested on CI like the others!

rtfeldman avatar Sep 26 '22 08:09 rtfeldman

The corresponding examples in the current repo are working fine, so this issue can be closed. @Anton-4 ?

Ivo-Balbaert avatar Aug 06 '23 15:08 Ivo-Balbaert

% roc dev examples/cli/echo.roc
🔨 Rebuilding platform...
🗣  Shout into this cave and hear the echo! 👂👂👂
hello
          hello    hell   hel  he h
^C
% roc dev examples/cli/http-get.roc 
🔨 Rebuilding platform...
Please enter a URL to fetch

lukewilliamboswell avatar Aug 06 '23 22:08 lukewilliamboswell