mpartel

Age: 25

May
12
comment A case class as a "wrapper" class for a collection. What about map/foldLeft/
What's your Scala version? 2.10.1 for me.
May
12
answered A case class as a "wrapper" class for a collection. What about map/foldLeft/
May
6
awarded Enthusiast
May
2
comment Best way to make a shell script daemon?
start-stop-daemon was surprisingly convenient to use
Apr
28
comment Where is "?" placeholder of sql in play2's anorm
type less and read less
Apr
27
answered Generics and parameterized types in Java
Apr
23
comment Rigid type error combined with IO and polymorphic types
If googling for that error doesn't help, try opening a new question and show in more detail where the error occurs.
Apr
22
comment Rigid type error combined with IO and polymorphic types
The question was phrased in a way that led me to believe you aimed to write an interpreter with debugging functionality as a feature, as opposed to needing to simply quickly debug your code. For the latter, Debug.Trace is fine, but for the former it's very questionable IMHO.
Apr
22
comment Rigid type error combined with IO and polymorphic types
Debug.Trace wraps that, though it may be instructive to implement trace yourself too.
Apr
22
comment Rigid type error combined with IO and polymorphic types
I probably shouldn't be telling you this, but for quick and dirty temporary debugging print statements, it's possible to use System.IO.Unsafe, which allows you to "escape" the IO monad. I certainly wouldn't leave it in the final product though. It's generally considered very bad practice. Also, it's cheating :)
Apr
21
comment Rigid type error combined with IO and polymorphic types
I recommend abstracting over the monad m (instead of an opaque o), and using the do syntax as shown in the answer.
Apr
20
comment Rigid type error combined with IO and polymorphic types
Monadic I/O indeed tends to be "contagious".
Apr
20
answered Rigid type error combined with IO and polymorphic types
Apr
13
comment Do anti-ship drones sometimes intercept enemy energy shot weapons?
It's easy to miss but it clearly happens every now and again.
Apr
13
awarded Supporter
Apr
8
answered Creating the Singleton design pattern in PHP5
Apr
8
comment Creating the Singleton design pattern in PHP5
This does not work when there is more than one subclass! $instance resides in Singleton, not the subclass. After some subclass is instantiated, getInstance() will return that instance for all subclasses.
Mar
17
comment How would i generate a random and unique string in Ruby?
There is also the potential (if improbable) race condition of two requests trying to add the same name at the same time. The database should have a unique constraint on that column and you should be prepared to catch ActiveRecord::RecordNotUnique.
Mar
6
awarded Critic
Mar
6
answered Where do these methods belong to?
1 2 3 4 5