-
Notifications
You must be signed in to change notification settings - Fork 569
Open
Labels
Description
Description
Following official documentation, to call show upon a data value inside JS I just need to do that, it should Just Work™.
But for some reason show returns undefined. More over, if I do spago bundle-app and look at the resulting index.js, I don't even see the string for the Show instance to produce, so if there's some odd trick required, it's impossible to derive from the output.
This came up as part of forum discussion.
To Reproduce
-
Create
src/Main.pursas:module Main where import Prelude import Effect (Effect) data Foo = Foo instance fooShow :: Show Foo where show Foo = "Foo" -- | re-export of `show` show_ :: ∀ a. Show a => a -> String show_ = show foreign import printFoo :: Foo -> Effect Unit main :: Effect Unit main = printFoo Foo -- same as `log $ show Foo`
and
src/Main.jsas:import { show_ } from '../Main/index.js'; export const printFoo = function(foo) { return function () { console.log(show_(foo)); }; };
-
Execute
spago run
Expected behavior
It should output Foo, not undefined
PureScript version
0.15.15
Reactions are currently unavailable