User loginNavigation |
archivesMultiple overloads of the bind operatorHi! Let's say it makes a lot of sense in my domain to define the types WriteReference and ReadOnlyReference. I wish to create a monad that manipulates references, so my first idea was to define
return :: a -> ReadOnlyReference a It looks ugly but it does its job, even though I fear it won't play nice with Haskell syntactic sugar for monads. Does it make more sense to define Reference as a class, and then to define WriteReference and ReadOnlyReference as instances of this class, so that we can write something like:
class Reference r where get :: r a -> a instance Reference WR where get (WR x) = x instance Reference RR where get (RR x) = x bind :: (Reference r1, Reference r2) => r1 a -> (a -> r2 b) -> r2 b Can anyone help me understand why I should favor one approach over the other? Thanks Fighting Bit Rot with Types (Scala Collections)didn't see it mentioned yet. i would excerpt the abstract were it not for the fact that the pdf is horribly broken such that no spaces are copied-and-pasted. yay usability. the gist: statically typed collections library ends up with duplication, ironically? and new advances let it be excitingly refactored to make everybody happy again. i think that is interesting because i do believe static typing has some gotchyas. Have tracing JIT compilers won?I've been watching the interpreter and JIT compiler competitions a bit in the JavaScript and Lua worlds. I haven't collected much organized data but the impression I'm getting is that tracing JIT's are turning up as the winners: sometimes even beating programs statically compiled with GCC. Is there a growing body of evidence that tracing JIT compilers are the horse to bet on? Will a more static style JIT like Google's V8 be able to keep up? Thanks, [I promoted this item to the front page, since the discussion is highly interesting & informative. -- Ehud] |
Browse archivesActive forum topics |
Recent comments
22 weeks 3 days ago
22 weeks 4 days ago
22 weeks 4 days ago
44 weeks 5 days ago
49 weeks 5 hours ago
50 weeks 4 days ago
50 weeks 4 days ago
1 year 1 week ago
1 year 5 weeks ago
1 year 5 weeks ago