This file contains 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
data Lit = Lit Int | |
data Add l r = Add l r | |
class Eval x where | |
eval :: x -> Int | |
instance Eval Lit where | |
eval (Lit x) = x | |
instance (Eval l, Eval r) => Eval (Add l r) where |
This file contains 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
import Control.Monad | |
import System.FilePath | |
import System.Directory | |
import Data.Maybe | |
redoPath :: FilePath -> IO (Maybe FilePath) | |
redoPath target = listToMaybe `liftM` filterM doesFileExist candidates | |
where candidates = map (++ ".do") $ target : fallbacks | |
fallbacks = map (`replaceBaseName` "default") $ filter hasExtension [target] |