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
module Simpath.Common where | |
justIf :: Bool -> a -> Maybe a | |
justIf b a = if b then Just a else Nothing | |
mapOrElse :: (a -> b) -> b -> Maybe a -> b | |
mapOrElse f b ma = case ma of { Just a -> f a; _ -> b } |
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
module Simpath.Border where | |
import Control.Monad.State (State, get, put, evalState) | |
import Simpath.Common | |
import Simpath.Edge | |
import Data.Set (Set) | |
import qualified Data.Set as Set | |
data Border = Border { edge :: Edge, done :: Maybe Int } deriving (Show) |
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
module Simpath.CounterMap where | |
import Data.Map (Map) | |
import qualified Data.Map as Map | |
import qualified Data.Foldable as Foldable | |
import Data.Function | |
import qualified Simpath.Frontier as F | |
import Simpath.Frontier (Frontier) | |
import Simpath.Border (Border) |
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 FlexibleContexts #-} | |
module Simpath.Frontier where | |
import Control.Applicative | |
import Control.Monad | |
import Control.Monad.State (State, state, get, put, runState) | |
import Data.Set (Set) | |
import qualified Data.Set as Set | |
import qualified Data.Foldable as Foldable | |
import Simpath.Common |
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
module Simpath.Edge where | |
import Prelude hiding (either) | |
import Data.Function | |
import Data.Set (Set) | |
import Control.Applicative | |
import qualified Data.Set as Set | |
import qualified Data.Foldable as Foldable | |
type Node = Int |
NewerOlder