Comment

Comment by EdwardDiego

It's been a very long age since I wrote any F#, really enjoyed it at the time and it was for fun stuff, I wasn't trying to deal with errors, just things like process a prefix trie in a cool way, but does

  Result<'T, 'TError> 
really have no upper type bounds on TError?

I'm assuming that's the case from the fact that he's arguing for a basic interface (Does F# support structural typing, or do you need to say that AtlasError implements IError or whatevs?), and I'm really surprised there isn't one.

Huh, would love to know why leaving it unbounded was decided upon. Might be I don't quite grok the culture of F#.

This reminds me of a very common and awful Python pattern, where, as there's no `message` attribute on the base error/exception classes, despite every nearly every exception or error having one, this is the normal pattern to access it:

  message = ex.args[0]
It gets really fun when you get an IndexError because one exception had no message provided when instantiated, so then you find code like:

  message = ex.args[0] if ex.args else None
Yech.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton