Compare commits

...

2 Commits

Author SHA1 Message Date
035ee14144 Add a module name to HW4 Part 2. 2020-10-26 19:16:32 -07:00
e567872503 Add a more elegant while implementation. 2020-10-26 19:16:17 -07:00
2 changed files with 3 additions and 2 deletions

View File

@@ -32,7 +32,7 @@ program =
] ]
while :: Expr -> Prog -> Stmt while :: Expr -> Prog -> Stmt
while cond body = Loop $ If cond [] [ Break ] : body while cond body = Loop [ If cond body [ Break ] ]
sumFromTo :: Int -> Int -> Prog sumFromTo :: Int -> Int -> Prog
sumFromTo f t = sumFromTo f t =

View File

@@ -1,3 +1,5 @@
{-# LANGUAGE GADTs #-}
module HW4Part2 where
{- {-
- int ::= (any integer) - int ::= (any integer)
- -
@@ -18,7 +20,6 @@
- prog ::= \epsilon | stmt; prog - prog ::= \epsilon | stmt; prog
-} -}
{-# LANGUAGE GADTs #-}
import Control.Monad.Except import Control.Monad.Except
import Control.Monad.State import Control.Monad.State
import Data.Bool import Data.Bool