1
1
mirror of https://github.com/github/semantic.git synced 2024-12-19 04:41:47 +03:00

Implement GSequenceable over [] directly.

This commit is contained in:
Rob Rix 2016-07-22 16:13:54 -04:00
parent 609a90fb90
commit dabffff7d0

View File

@ -1,7 +1,6 @@
{-# LANGUAGE TypeOperators #-}
module Data.Sequenceable.Generic where
import Data.Sequenceable
import GHC.Generics
import Prologue
@ -38,4 +37,6 @@ instance (GSequenceable f, GSequenceable g) => GSequenceable (f :+: g) where
instance (GSequenceable f, GSequenceable g) => GSequenceable (f :*: g) where
gsequenceAlt (a :*: b) = (:*:) <$> gsequenceAlt a <*> gsequenceAlt b
instance GSequenceable [] where gsequenceAlt = sequenceAlt
instance GSequenceable [] where
gsequenceAlt (x:xs) = ((:) <$> x <|> pure identity) <*> gsequenceAlt xs
gsequenceAlt [] = pure []