1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Add Algorithm.

This commit is contained in:
Rob Rix 2015-11-17 16:24:01 -08:00
parent c56cc6cb74
commit 5438acf1fb
2 changed files with 5 additions and 2 deletions

View File

@ -1 +1,6 @@
module Algorithm where module Algorithm where
import Control.Monad.Free
import Operation
type Algorithm a = Free (Operation a)

View File

@ -33,8 +33,6 @@ d = Free $ Keyed $ fromList [
("hello", Free $ Indexed [ Just (Info :< Leaf "hi") </> Nothing ]), ("hello", Free $ Indexed [ Just (Info :< Leaf "hi") </> Nothing ]),
("goodbye", Just (Info :< Leaf "goodbye") </> Just (Info :< Indexed [])) ] ("goodbye", Just (Info :< Leaf "goodbye") </> Just (Info :< Indexed [])) ]
-- type Algorithm a = Free (Operation a)
cost :: Diff a -> Integer cost :: Diff a -> Integer
cost f = iter c $ fmap g f where cost f = iter c $ fmap g f where
c (Leaf _) = 0 c (Leaf _) = 0