[Haskell-cafe] Use of abbreviations in Haskell

Cristiano Paris frodo at theshire.org
Fri Jan 2 15:37:55 EST 2009


On Fri, Jan 2, 2009 at 9:21 PM, Miguel Mitrofanov <miguelimo38 at yandex.ru> wrote:
> module Element where
> import QName
> import ...
> data Element = Element {name :: QName, attribs :: [Attr], content ::
> [Content], line :: Maybe Line}
>
> module Attr where
> import QName
> import ...
> data Attr = Attr {key :: QName, val :: String}
>
> module QName where
> import ...
> data QName = QName {name :: String, uri :: Maybe String, prefix :: Maybe
> String}
>
> module Main where
> import qualified QName as Q
> import qualified Element as E
> ... Q.name ... E.name ...

I'm using this pattern of writing code and, so far, I find it very
convenient. Yet, the code is likely to be spread across lots of files,
which is not always a Good Thing.

Cristiano


More information about the Haskell-Cafe mailing list