packages feed

liquidhaskell-0.6.0.0: tests/pos/StructRec.hs

module ListLen () where

{-@ autosize OList @-}

data OList a =
     Mt
   | Ln{h :: a, t :: OList a}

{-@ data OList a =
      Mt
    | Ln{h :: a, t :: OList {v:a | h <= v}} @-}

insert :: (Ord a) => a -> OList a -> OList a
insert y Mt        = Ln y Mt
insert y (Ln x xs)
  | y <= x         = Ln y (Ln x xs)
  | otherwise      = Ln x (insert y xs)