module NonDet where type L a = [a] unitL :: a -> L a unitL a = [a] [] `appendL` xs = xs (x:xs) `appendL` ys = x : (xs `appendL` ys) bindL :: L a -> (a -> L b) -> L b (a:es) `bindL` k = k a `appendL` (es `bindL` k) [] `bindL` k = [] tryL :: L a -> L a -> L a tryL (v:vs) h = v : tryL vs h tryL [] h = h failL :: String -> L a failL _ = []