coding style - Haskell similar types copy-paste elimination in case -


case x of    cond expr stmt ->         checkexprtype expr bool         processstmt env stmt         return env   anothercond expr stmt ->         checkexprtype expr bool         processstmt env stmt         return env 

how can copy-paste eliminated?

you make local definition function of expr , stmt:

-- assume inside 'do' block let conditionallike expr stmt =         checkexprtype expr bool         processstmt env stmt         return env case x of     cond expr stmt -> conditionallike expr stmt     anothercond expr stmt -> conditionallike expr stmt 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -