...and you can always do
hack :: Vec n a -> FixedVec a
hack x :: FixedVec undefined
One option could be something like:data Zdata S n
data Vec n a whereNil :: Vec Z aCons :: a -> Vec n a -> Vec (S n) adata Length n whereOne :: Length (S Z)Two :: Length (S (S Z))Seventeen :: Length (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S Z)))))))))))))))))data FixedVec a whereFixedVec :: Legnth n -> Vec n a -> FixedVec aBut it's obviously rather cumbersome :)On Wed, Oct 13, 2010 at 7:57 AM, Jason Dusek <jason.dusek@gmail.com> wrote:
Is there a way to write a Haskell data structure that is
necessarily only one or two or seventeen items long; but
that is nonetheless statically guaranteed to be of finite
length?
--
Jason Dusek
Linux User #510144 | http://counter.li.org/
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe