search :: Store s => ByteString -> Act s ()
search ss = do
  Status _ l <- lift $ get
  let
    str = init $ unpack ss
    s = map pack $ splitOn "." str
    fu :: [ByteString] -> Save s -> Maybe s
    fu [] _ = Nothing
    fu [x] (Save (s,u)) = join $ (fmap fst . snd) <$> (M.lookup x s <|> u x)
    fu (x:xs) (Save (s,u)) = case M.lookup x s <|> u x of
      Just (s',_) -> fu xs s'
      Nothing -> Nothing
  case fu s l of
    Nothing -> outputStrLn $ "Not in scope : " ++ str
    Just l -> outputStrLn $ str ++ " = " ++ show l
  ev ""
search :: Store s => ByteString -> Act s ()
search ss = do
  Status _ l <- lift $ get
  let
    str = init $ unpack ss
    s = map pack $ splitOn "." str
    fu :: [ByteString] -> Save s -> Maybe s
    fu [] _ = Nothing
    fu [x] (Save (s,u)) = join $ (fmap fst . snd) <$> (M.lookup x s <|> u x)
    fu (x:xs) (Save (s,u)) = case M.lookup x s <|> u x of
      Just (s',_) -> fu xs s'
      Nothing -> Nothing
  case fu s l of
    Nothing -> outputStrLn $ "Not in scope : " ++ str
    Just l -> outputStrLn $ str ++ " = " ++ show l
  ev ""
search ss = do
  Status _ l <- lift $ get
  let
    str = init $ unpack ss
    s = map pack $ splitOn "." str
    fu :: [ByteString] -> Save s -> Maybe s
    fu [] _ = Nothing
    fu [x] (Save (s,u)) = join $ (fmap fst . snd) <$> (M.lookup x s <|> u x)
    fu (x:xs) (Save (s,u)) = case M.lookup x s <|> u x of
      Just (s',_) -> fu xs s'
      Nothing -> Nothing
  case fu s l of
    Nothing -> outputStrLn $ "Not in scope : " ++ str
    Just l -> outputStrLn $ str ++ " = " ++ show l
  ev ""