Skip to content

Printing runtime representation of a value#4

Merged
paf31 merged 1 commit intopurescript:masterfrom
zudov:inspect
Aug 20, 2015
Merged

Printing runtime representation of a value#4
paf31 merged 1 commit intopurescript:masterfrom
zudov:inspect

Conversation

@zudov
Copy link
Copy Markdown
Contributor

@zudov zudov commented Aug 19, 2015

I find that sometimes I need to do things like:

log $ unsafeCoerce { foo: bar, baz: qux }

Might be useful to have a function for that, what do you think?

It feels kind of wrong to have forall a. a -> ..... Perhaps it would make sense to put it into Unsafe module. On the other hand I can't come up with a case where doing console.log(something) would nuke anyone.

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Aug 19, 2015

I think purescript-debug has something along these lines...

@zudov
Copy link
Copy Markdown
Contributor Author

zudov commented Aug 19, 2015

@paf31 Oh, I'll take a look

@zudov
Copy link
Copy Markdown
Contributor Author

zudov commented Aug 19, 2015

@paf31 Well, there is traceAny, which is definitely unsafe. It would be nicer to be able to log arbitrary value, without completely breaking out of controlled effects.

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Aug 19, 2015

ok, makes sense. Maybe put this into an Unsafe module though. I'd probably just call it logAny to be consistent with -debug.

@zudov
Copy link
Copy Markdown
Contributor Author

zudov commented Aug 19, 2015

@paf31 I like that name (I mean the one that you gave)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/dodgy/unsafe maybe? 😄

Also not sure about "runtime representation", how about just "display arbitrary values"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Dodgy/Unsafe/ makes sense.

Is something technically wrong with "runtime representation"? It seems like a good explanation of what happens there.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I think it's right, but I use the term in the PureScript book, and it's not quite the same thing. The way I've used it previously implies structure all the way to the leaves of the tree of values.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paf31 Makes sense. Fixed.

paf31 added a commit that referenced this pull request Aug 20, 2015
Printing runtime representation of a value
@paf31 paf31 merged commit 7d8372f into purescript:master Aug 20, 2015
@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Aug 20, 2015

Thanks!

@zudov zudov deleted the inspect branch August 20, 2015 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants