Anonymous records. A solution to the problems of record-system.
Wvv
vitea3v at rambler.ru
Mon Oct 14 20:13:58 UTC 2013
1) This system is week.
It is still impossible write
type Person = (lastName::Sting, name :: String)
type Image = ( name :: ByteString, sizeX :: Int, sizeY :: Int )
name :: (b ~ Stirng) => (a,b) -> b
name :: (a ~ ByteString) => (a,b,c) -> a
2) you already could write
name :: (String, b) -> String
name (a, _) = a
You even could write now :
data Person = Person Sting String
data Image = Image ByteString Int Int
class Rec_Name a where
type OutRec_Name a
name :: a -> OutRec_Name a
instance (OutRec_Name Person ~ String) => Rec_Name Person
type OutRec_Name Person = String
name (Person _ a) = a
instance (OutRec_Name Image ~ ByteString) => Rec_Name Image
type OutRec_Name Image = ByteString
name (Person a _ _) = a
--
View this message in context: http://haskell.1045720.n5.nabble.com/Anonymous-records-A-solution-to-the-problems-of-record-system-tp5738476p5738498.html
Sent from the Haskell - Haskell-prime mailing list archive at Nabble.com.
More information about the Haskell-prime
mailing list