Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Graph.hs:36:14:
- Couldn't match type `Int' with `Maybe Int'
- When using functional dependencies to combine
- Control.Monad.State.Class.MonadState s (StateT s m),
- arising from the dependency `m -> s'
- in the instance declaration in `Control.Monad.State.Class'
- Control.Monad.State.Class.MonadState
- (IM.IntMap (Maybe Int))
- (StateT
- (IM.IntMap Int)
- (Control.Monad.Trans.Reader.ReaderT
- (IM.IntMap (IM.IntMap Int)) Data.Functor.Identity.Identity)),
- arising from a use of `get' at Graph.hs:36:14-16
- In a stmt of a 'do' block: distance <- get
- In the expression:
- do { γ <- ask;
- distance <- get;
- let candidates :: [Vertex]
- candidates = ...
- ....;
- case newVertex of {
- Just (v, d) -> do { ... }
- Nothing -> return False } }
- ---------------
- step ∷ StateT (IM.IntMap Distance) (Reader Graph) Bool
- step = do
- γ ← ask
- distance ← get --line 36
- let candidates ∷ [Vertex]
- candidates = concatMap nub . map (\v → (IM.keys $ γ IM.! v) \\ (IM.keys distance)) $ IM.keys distance ∷ [Vertex]
- nearestWay ∷ Vertex → Distance
- nearestWay c = minimum . catMaybes . map (\v → (+ distance IM.! v) `fmap` IM.lookup c $ γ IM.! v) $ IM.keys distance
- newVertex ∷ Maybe (Vertex, Distance)
- newVertex = listToMaybe . sortBy (compare `on` snd) . map (\c → (c, nearestWay c)) candidates
- case newVertex of
- Just (v, d) → do
- put $ IM.insert v d distance
- return True
- Nothing → return False
Advertisement
Add Comment
Please, Sign In to add comment