Haskell provides a standard typeclass 'Alternative' that effectively provides the <|> operator for any type that is also an Applicative. As I understand it Alternative is considered a Monoid on Applicative's, however the <|> operator seems to make complete sense in a lot of types that aren't Applicative Functors as...

I have the following type: data SomeType = Var String deriving (Eq,Show) newtype TypeA = TypeA [(String, SomeType)] deriving (Eq,Show) Also, I have a function: fun1 :: TypeA -> TypeA -> TypeA I can use this function for mappend. I don't understand, how to implement Monoid interface in my case....

This question is about HXT, but I guess it's applicable to conception of ArrowPlus in general. Consider the following program: module Main (main) where import Text.XML.HXT.Core import Control.Monad (void) main :: IO () main = void $ runX $ root [] [foo] >>> writeDocument [withIndent yes] "test.xml" foo :: ArrowXml...

There is an instance Monoid a => Monoid (Const a b) for the Const functor from Control.Applicative. There is also an instance Monoid m => Applicative (Const m). I would therefore expect that there is also an instance Monoid m => Alternative (Const m) that coincides with the one for...

I'm playing around with type-aligned sequences, and in particular I'm messing around with the idea of folding them. A foldable type-aligned sequence looks something like this: class FoldableTA fm where foldMapTA :: Category h => (forall b c . a b c -> h b c) -> fm a b...

Hi I am studying the Advanced Scala book, and I have some trouble understading this piece of code from scalaz source: object Tag { /** `subst` specialized to `Id`. * * @todo According to Miles, @specialized doesn't help here. Maybe manually specialize. */ @inline def apply[@specialized A, T](a: A): A...