X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;ds=sidebyside;f=Flatten.hs;h=f7ab86ce107ed770e6bbc46e3d67186e83eccdb9;hb=72a84356f5507b73d4d5f84844aac9334ee17795;hp=1297793356dfa8e17223fd034086202ace7584be;hpb=1f0b33729534d451d7dcc46d4614d1a12b31ea82;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git a/Flatten.hs b/Flatten.hs index 1297793..f7ab86c 100644 --- a/Flatten.hs +++ b/Flatten.hs @@ -28,21 +28,22 @@ genSignals :: -> FlattenState (SignalMap UnnamedSignal) genSignals ty = do - typeMapToUseMap tymap + typeMapToUseMap SigInternal tymap where -- First generate a map with the right structure containing the types tymap = mkHsValueMap ty typeMapToUseMap :: - HsValueMap Type.Type + SigUse + -> HsValueMap Type.Type -> FlattenState (SignalMap UnnamedSignal) -typeMapToUseMap (Single ty) = do - id <- genSignalId +typeMapToUseMap use (Single ty) = do + id <- genSignalId use ty return $ Single id -typeMapToUseMap (Tuple tymaps) = do - usemaps <- State.mapM typeMapToUseMap tymaps +typeMapToUseMap use (Tuple tymaps) = do + usemaps <- State.mapM (typeMapToUseMap use) tymaps return $ Tuple usemaps -- | Flatten a haskell function @@ -53,12 +54,12 @@ flattenFunction :: flattenFunction _ (Rec _) = error "Recursive binders not supported" flattenFunction hsfunc bind@(NonRec var expr) = - FlatFunction args res apps conds [] + FlatFunction args res apps conds sigs where - init_state = ([], [], 0) + init_state = ([], [], [], 0) (fres, end_state) = State.runState (flattenExpr [] expr) init_state (args, res) = fres - (apps, conds, _) = end_state + (apps, conds, sigs, _) = end_state flattenExpr :: BindMap