Loading ...
Sorry, an error occurred while loading the content.

166HaskellDB, static typing, combinators, and ObPerl

Expand Messages
  • Shae Matijs Erisson
    Mar 29, 2005
      --- In extremeperl@yahoogroups.com, Rob Nagler <nagler@b...> wrote:

      > I always thought that was the customer's job. ;-) Seriously, is there
      > any evidence that forcing programs to decompose problems the Haskell
      > way is any better than the Perl way?

      My opinion is that the Haskell way is better. And the Perl way is better.
      I think the best choice for any given goal depends on the timeframe, the
      customer, and more. Some times the best choice is to use them all!
      ( for example - http://c2.com/cgi/wiki?AlternateHardAndSoftLayers )

      > http://www.haskell.org/hawiki/HaskellDbTutorial
      > Do you have experience with this? Is it better to program this way
      > than with good old SQL?

      Database theory is (pretty much) the same as set theory.
      ( see http://en.wikipedia.org/wiki/Database_theory )
      One pattern in Haskell is to make a 'domain specific language.'
      In the case of HaskellDB, this is used to do set theory operations directly in
      the Haskell language. So I wrote that "HaskellDB is a database UNwrapper for
      Haskell" because the database stuff happens directly in Haskell, and is then
      mapped to SQL, or whatever relational language. (Yes, I wrote that tutorial.)

      I think the same thing could be done in Perl by making a bunch of infix
      functions that expect other infix functions that only work with set theory
      operations. You'd end up with code that generates only legal SQL or errors.
      (Those sorts of functions are called combinators, for more detail see
      http://en.wikipedia.org/wiki/Combinator )

      > I haven't found the lack of type safety in Perl to be hindrance in
      > performance or quality so I'd like to see some evidence that programming in a
      > type safe language is any better for the customer. Are there any studies out
      > there that compare programming Perl vs Haskell to do the same job?

      In my opinion, static type safety is just one tool in the toolbox.
      In Haskell you're not forced to see the type system all the time like you are
      in Java. I jokingly refer to Haskell as 'compile-time dynamic typing'.
      You can use Dynamics in Haskell to escape the type system entirely, or you can
      use the HaXml approach where everything is a typesafe algebraic datatype.

      A type system is simplified automated proof checking software. One example of a
      cool useful type trick is Simon Peyton-Jones' financial contracts combinators:
      http://research.microsoft.com/Users/simonpj/Papers/financial-contracts/contracts-icfp.htm
      This sort of application is valuable to the customer, to the point that a
      company was started based on this idea alone: http://www.lexifi.com/
      --
      Programming is the Magic Executable Fridge Poetry, | www.ScannedInAvian.com
      It is machines made of thought, fueled by ideas. | -- Shae Matijs Erisson
    • Show all 3 messages in this topic