mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
Add Algorithm.
This commit is contained in:
parent
c56cc6cb74
commit
5438acf1fb
@ -1 +1,6 @@
|
|||||||
module Algorithm where
|
module Algorithm where
|
||||||
|
|
||||||
|
import Control.Monad.Free
|
||||||
|
import Operation
|
||||||
|
|
||||||
|
type Algorithm a = Free (Operation a)
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user