From: Bjorn B. <bri...@cs...> - 2006-07-29 23:13:42
|
On Jul 28, 2006, at 2:26 PM, Marc Weber wrote: > I've tried understanding what the BoundedList.hs module is all =20 > about but > I couldn' get it completely > > -- This inductive approach gives the complexity O(n) on the number =20 > of instances > -- and very short type checking times compared to an O(n\^2) =20 > implementation. > > Where is the difference between [a] and (BoundedList a Nxx)? > Is it only used for BoundedString by now? > (to prevent data loss when copying from char(10) to char(4)? Yes, BoundedList is only used for BoundedString in HaskellDB. The =20 purpose of BoundedString is, as you guessed, to avoid string =20 truncation. For more information, see our Haskell Workshop paper, =20 http://haskelldb.sourceforge.net/haskelldb.pdf > Did I get it right that the internal representation is still an =20 > ordinary > list ? (newtype BoundedList a n =3D BoundedList [a])? Yes. BoundedList uses a phantom type to keep the string max length in =20= the type of the list. The internal representation is a normal list. > Looking at > > instance (Show a, Size n) =3D> Show (BoundedList a n) where > show l@(L xs) =3D show xs > > l@ is superfluous, isn't it? Yes. There are probably lots of unused bindings in the HaskellDB =20 code. I guess we should compile with -Wall and fix all the warnings. /Bj=F6rn |