[Haskell-cafe] Promoting associated data types
Kosyrev Serge
_deepfire at feelingofgreen.ru
Sat Jun 27 19:59:46 UTC 2015
I'm sorry, I made a mistake in the type signature of 'prefer' --
CatEntry ought to be CatAssoc:
> prefer ∷ Category c ⇒ c → CatAssoc → CatX c → CatX c
yielding:
> prefer ∷ Category c ⇒ c → CatAssoc → CatX c → CatX c
> prefer cat (CatAssoc xs) defx =
> case find (\(CatEntry (icat, _)) → cat == icat) xs of
> Just (CatEntry (icat, x)) → x
> Nothing → defx
..and
> prefer ∷ Category c ⇒ c → CatAssoc → LayoutName c → LayoutName c
> prefer cat (CatAssoc xs) deflayout =
> case find (\(CatEntry (icat, _)) → cat == icat) xs of
> Just (CatEntry (icat, lay)) → lay
> Nothing → deflayout
--
respectfully,
Косырев Серёга
More information about the Haskell-Cafe
mailing list