state of Standard
Serge D. Mechveliani
mechvel@botik.ru
Fri, 14 Mar 2003 15:51:17 +0300
Dear Haskellers,
Could you, please, tell me what is the recent state of the
Haskell Standard development?
I have a wish for the Standard Library: FiniteMap, Set
(of GHC library).
And I have a question on the function name overloading,
and on the record field name overloading.
A language should support a natural naming of objects.
For example:
data Operator =
Operator{opName :: String,
opWeight :: Int,
opSortage :: ([String],[String],String),
opOrd :: Int,
opPrecedences :: (Int, Int)
}
is not good -- due to `op' prefix.
And many other data also have name, weight, ord, and so on.
So, one may try to introduce
class WithName a where name :: a -> String
set_name :: a -> String -> a
class WithWeight a where weight :: a -> Int
set_weight :: a -> Int -> a
...
trivialOperator = Operator{ ... some trivial setting ...}
,
to change the names like opName to opName__, opWeight__, ...
to show that the latter are local and not for usage,
to introduce
instance WithName Operator where name = opName__
...
,
and then, use all this, for example, as follows:
let
nm = name opr
opr' = set_name "foo" $
set_weight 1 $
set_ord 2 $ opr
in ...
This leads to following complications.
* Class declarations add.
* The Standard does not allow to define the instances like
type BN = (String, Bool)
instance WithName BN where name = fst
* There are many operations that should be synonymic but have
different kind. For example,
weight :: a -> Int
weight :: Table -> a -> Int
This leads to adventures with multiple parameter classes,
and so on.
Similar difficulties arise with the function names.
Is Haskell all right at this point?
Reply, please, to mechvel@botik.ru
Thank you in advance for the explanation.
-----------------
Serge Mechveliani
mechvel@botik.ru