[Haskell-beginners] Using findIndex and then splitAt in Data.List

Michael Orlitzky michael at orlitzky.com
Sat Feb 28 14:08:46 UTC 2015


On 02/27/2015 03:51 PM, Geoffrey Bays wrote:
> Hi.
> An elementary question here about two functions in Data.List:
>  how to use a value from findIndex which returns a Maybe Int,
> and then use that result in splitAt which takes a regular Int?

Once you understand why you can't feed a (Maybe Int) to a function that
takes an Int, throw it all away and use `splitOn` from the "split"
package instead =)

https://hackage.haskell.org/package/split-0.2.2/docs/Data-List-Split.html



More information about the Beginners mailing list