I tried to do something simple using the rmonad package (attached).

I followed the example that's in haddocks (it is wrong, constraints has
no arguments), grabbed the list of extensions from rmonad's source, but
this program doesn't typecheck:

Could not deduce (Hashable a) arising from a use of `HM.singleton'

This seems to be an obvious use of this package ... am I missing something ?
{-# LANGUAGE MultiParamTypeClasses, TypeFamilies, ScopedTypeVariables, FlexibleInstances  #-}
module Test where

import Control.RMonad.Prelude
import Data.Suitable (Constraints)
import qualified Data.HashMap.Strict as HM
import Data.Hashable (Hashable)

data MonadOutcome st = MonadOutcome { getOutcome :: HM.HashMap st Rational } deriving (Show)
data instance Constraints MonadOutcome a = (Hashable a, Eq a) => OutcomeConstraints

instance (Hashable a, Eq a) => Suitable MonadOutcome a where
    constraints = OutcomeConstraints

instance RMonad MonadOutcome where
    return x = MonadOutcome (HM.singleton x 1)
    (>>=) = undefined
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to