On Wed, 2008-11-12 at 10:50 -0800, Don Stewart wrote: > tux_rocker: > > 2008/11/11 Dave Tapley <[EMAIL PROTECTED]>: > > > So I should clarify I'm not a troll and do "see the Haskell light". But > > > one thing I can never answer when preaching to others is "what does > > > Haskell not do well?" > > > > Let's say something controversial: I think that Haskell's type system > > gets in your way when you're writing one-shot scripts that don't need > > to conform to the highest correctness standards. Imagine typing a > > command at the shell prompt and getting the sort of abstract error > > message that Haskell compilers give every now and then, like: > > > > > whyerror.lhs:36:25: > > > Ambiguous type variable `a' in the constraint: > > > `Arrow a' arising from use of `>>>' at whyerror.lhs:36:25-27 > > > Possible cause: the monomorphism restriction applied to the > > > following: > > > liftA2' :: forall b a1 b1 c. (a1 -> b1 -> c) -> a b a1 -> a b > > > b1 -> a b c > > > (bound at whyerror.lhs:36:1) > > > unsplit' :: forall a1 b c. (a1 -> b -> c) -> a (a1, b) c > > > (bound at whyerror.lhs:34:1) > > > split' :: forall b. a b (b, b) (bound at whyerror.lhs:33:1) > > > Probable fix: give these definition(s) an explicit type signature > > > or use -fno-monomorphism-restriction > > > > You don't want to be bothered by such monstrosities (yes, they are, > > even though many of you may not see it because of years of > > conditioning) when you're just hacking up a simple script to make a > > catalog of your MP3 collection / check for patterns in log files / > > whatever. > > Why are you using Arrows in your one shot scripts?
Because a generic operator like (>>>) is a) More likely to exist, and b) easier to remember than a special case operator like --- actually, I don't think GHC does come with a standard version of (>>>) type-specialized to functions, only a version of (<<<). Or if it does, I can't remember it. > Do you use Arrows in > your shell scripts? I use pipelines. Frequently. I even type them up at the command line. Beyond that, I was considering the pipeline uses -l snippet_calculate\\b | perl -lne 'chomp; print $_ unless qx{svn st | grep $_}' (`uses' is a recursive grep-like shell function I have). The use of perl immediately suggested that it could profitably be re-written in Haskell (actually, in a similar FP language I've been designing --- not relevant); my translation included a line something like interactiveM $ filterM $ comp >>> \ x -> <translation of qx{svn st | grep $x}> So yeah, I use arrows in my shell scripts. Who doesn't? (On the other hand, I'm actively designing an FP shell-like language...) jcc _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe