This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE LambdaCase #-} | |
import Data.List (sort) | |
import Control.Monad (unless) | |
data Grade = Grade { | |
grade :: Float, | |
credits :: Int | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foldAST :: (Name -> Op -> Name -> a) -> (Name -> a) -> ([Argument] -> a -> a) -> AST -> a | |
foldAST fb fv ff = f | |
where f (BinExpr n1 o n2) = fb n1 o n2 | |
f (Variable n) = fv n | |
f (Function ps a) = ff ps $ f a |