never executed always true always false
1 {-# LANGUAGE TupleSections #-}
2
3 module Conjure.Process.Unnameds
4 ( removeUnnamedsFromModel
5 ) where
6
7 import Conjure.Prelude
8 import Conjure.Language.Definition
9 import Conjure.Language.Domain
10 import Conjure.Language.Type
11
12
13 -- | The argument is a model before nameResolution.
14 -- Only intended to work on problem specifications.
15 -- Replaces unnamed types with integers.
16 removeUnnamedsFromModel :: Monad m => Model -> m Model
17 removeUnnamedsFromModel model = do
18 statements' <- forM (mStatements model) $ \ st ->
19 case st of
20 Declaration (LettingDomainDefnUnnamed name@(Name nameText) size) -> do
21 let outDomain = mkDomainIntBTagged (TagUnnamed nameText) 1 size
22 return $ Declaration $ Letting name $ Domain outDomain
23 _ -> return st
24 return model { mStatements = statements' }