<html><head><style>p{margin-top:0px;margin-bottom:0px;}</style></head><body><div style="font-size:10pt; font-family:NanumGothic, 나눔고딕, sans-serif;"><p><span style="font-family: courier\ new, serif;">As </span><b><span style="font-family: courier\ new, serif;">instance Alternative ZipList</span></b><span style="font-family: courier\ new, serif;"> is defined since 4.11.0.0:</span><span>
</span></p><pre><a name="line-125"></a><b><span class="hs-keyword">instance</span><span> </span><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/GHC.Base.html#Alternative"><span class="hs-identifier hs-type">Alternative</span></a><span> </span><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/Control.Applicative.html#ZipList" class=""><span class="hs-identifier hs-type">ZipList</span></a><span> </span><span class="hs-keyword">where</span><span>
</span><a name="line-126"></a><span> </span><a name="local-8214565720323792759"></a><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/GHC.Base.html#empty"><span class="hs-identifier">empty</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/Control.Applicative.html#ZipList" class=""><span class="hs-identifier hs-var">ZipList</span></a><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><a name="line-127"></a><span> </span><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/Control.Applicative.html#ZipList" class=""><span class="hs-identifier hs-var">ZipList</span></a><span> </span><a name="local-6989586621679319881"></a><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/Control.Applicative.html#local-6989586621679319881" class=""><span class="hs-identifier">xs</span></a><span> </span><a name="local-8214565720323792760"></a><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/GHC.Base.html#%3C%7C%3E"><span class="hs-operator"><|></span></a><span> </span><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/Control.Applicative.html#ZipList" class=""><span class="hs-identifier hs-var">ZipList</span></a><span> </span><a name="local-6989586621679319882"></a><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/Control.Applicative.html#local-6989586621679319882" class=""><span class="hs-identifier">ys</span></a><span> </span><span class="hs-glyph">=</span><span> </span><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/Control.Applicative.html#ZipList" class=""><span class="hs-identifier hs-var">ZipList</span></a><span> </span><span class="hs-special">(</span><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/Control.Applicative.html#local-6989586621679319881" class=""><span class="hs-identifier hs-var">xs</span></a><span> </span><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/GHC.Base.html#%2B%2B" class=""><span class="hs-operator hs-var">++</span></a><span> </span><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/GHC.List.html#drop" class=""><span class="hs-identifier hs-var">drop</span></a><span> </span><span class="hs-special">(</span><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a><span> </span><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/Control.Applicative.html#local-6989586621679319881" class=""><span class="hs-identifier hs-var">xs</span></a><span class="hs-special">)</span><span> </span><a href="http://hackage.haskell.org/package/base-4.11.1.0/docs/src/Control.Applicative.html#local-6989586621679319882" class=""><span class="hs-identifier hs-var">ys</span></a></b><span class="hs-special"><b>)<br></b><br>It seems perfectly fine to make <b>Monoid</b> for <b>ZipList</b> as followings:<br><br><b>instance Semigroup a => Semigroup (ZipList a) where<br> ZipList [] <> ZipList ys = ZipList ys<br> ZipList xs <> ZipList [] = ZipList xs<br> ZipList (x:xs) <> ZipList (y:ys) = ZipList (x <> y : ZipList xs <> ZipList ys)<br><br>instance Semigroup a => Monoid (ZipList a) where<br> mempty = ZipList []</b><br></span><span></span><br>Note that this semantic is similar to that of <b>Maybe</b>.<br></pre></div></body></html><table style='display:none'><tr><td><img src="https://mail.naver.com/readReceipt/notify/?img=JdFCbHFTpz%2FYaqgZKrRZM4u%2FKxp4MoiCKoF0Fx2%2FKrivKrJSKqEdKq3SKop0KdIo%2BrkSKAv5W4d5W4C5bX0q%2BzkR74FTWx%2FsWz0Sb4JZ16kqtzCCbrR0Wzm5WXiN.gif" border="0"/></td></tr></table>