-- Some auxiliary functions

-- | create a new name for the iota morphism
mkFreeName :: Id -> Id
mkFreeName i@(Id ts cs r) = case ts of
  t : s -> let st = tokStr t in case st of
    c : _ | isAlphaNum c -> Id (freeToken st : s) cs r
          | otherwise -> Id [mkSimpleId "gn_free"] [i] r
    _ -> Id (mkSimpleId "gn_free_f" : ts) cs r
  _ -> i

-- | a prefix for free names
mkFreeName :: Id -> Id
mkFreeName i@(Id ts cs r) = case ts of
  t : s -> let st = tokStr t in case st of
    c : _ | isAlphaNum c -> Id (freeToken st : s) cs r
          | otherwise -> Id [mkSimpleId "gn_free"] [i] r
    _ -> Id (mkSimpleId "gn_free_f" : ts) cs r
  _ -> i

-- | a prefix for free names
mkFreeName i@(Id ts cs r) = case ts of
  t : s -> let st = tokStr t in case st of
    c : _ | isAlphaNum c -> Id (freeToken st : s) cs r
          | otherwise -> Id [mkSimpleId "gn_free"] [i] r
    _ -> Id (mkSimpleId "gn_free_f" : ts) cs r
  _ -> i

-- | a prefix for free names