Statically sized vectors in Haskell are shown in Oleg Kiselyov's Number-parameterized types and can also be found in the Data.Param.FSVec
type from the parameterized-data module on Hackage:
data Nat s => FSVec s a
FSVec
is not an instance of the Monad
type class.
The monad instance for lists, can be used to remove or duplicate elements:
Prelude> [1,2,3] >>= \i -> case i of 1 -> [1,1]; 2 -> []; _ -> [i]
[1,1,3]
Whether similar to the list version or not, is it possible to construct a monad from a fixed length vector?