It turns out there is no instance Foldablefor ByteString. I would like to write a function that uses foldl'for [Word8]or ByteString, but I cannot. Because a ByteString, in different ways, is the same as [Word8]it seems that I should be able to.
Foldable
ByteString
foldl'
[Word8]
Is there a package available that combines the two, or should I flip my class class?
Take a look at the MonoFoldable class specified in the mono-traversable package .
It has instances for ByteStringand [a].
[a]
ErikR . . lens bytes:
lens
λ> import Data.ByteString.Lens λ> import Control.Lens λ> :t foldrOf bytes foldrOf bytes :: IsByteString s => (GHC.Word.Word8 -> r -> r) -> r -> s -> r
, , - lens: Data.Foldable Data.Traversable, Foldable Traversable, , ?
Data.Foldable
Data.Traversable
Traversable
Source: https://habr.com/ru/post/1648944/More articles:Swift: case foo (let bar): no type or job? - iosWhich API to use to access location history for an Android app? - androidJSonConverter not starting property of my model in C # WebAPI - jsonMySQL query with time and random selection - phpCustom type serialization and deserialization using Newtonsoft.Json without attributes - c #Tracking shared_ptr owner? - c ++How to check if a string contains only alphabetic characters in Go? - goExcel VBA restarts the same routine within itself based on VbMsgBoxResult - excel-vbaMac OS X / bin / bash: python command: not found in some IDE - pythonOS X Sublime Text3 to use the zsh shell - bashAll Articles