Hi,

How do you organize code ?

Here is a sample.
Acturally, I am thinking about using this plan.

Any suggestions ?

> -- BasicalType.hs
> type Position = (Int,Int)
> data Box = Box { pos :: Position }
> data Chain = Chain { pos :: [Position] }

> -- Object.hs
> import BasicalType
> class Object o where
>   pos :: o -> [Position]

> -- Type.hs
> import BasicalType
> import Object
> instance Object Box where
>   pos = return . BasicalType.pos
> instance Object Chain where
>   pos = BasicalType.pos

> -- Main.hs
> import Type
> ...

    Regards
--------------
L.Guo
2008-01-28

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to