Just newlists -> newlistsNothing -> (gradeItemList,[])You will probably do a case match on the result of findIndex to find out whether you want to split there. You will have to deal with the possibility that the item you are searching for is not in the list. Untested:let twoListsTuple = case findIndex (\g -> (itemName g) == (itemName gradeItemP)) gradeItemList ofOn Fri, Feb 27, 2015 at 3:51 PM, Geoffrey Bays <charioteer7@gmail.com> wrote:_______________________________________________GeoffreyMany Thanks,// does not compile obviouslyand then use that result in splitAt which takes a regular Int?Hi.how to use a value from findIndex which returns a Maybe Int,
An elementary question here about two functions in Data.List:This is in an IO() doLike so: (This is in an IO() do block)
let gradeItemIndex = findIndex (\g -> (itemName g) == (itemName gradeItemP)) gradeItemList
let twoListsTuple = splitAt gradeItemIndex gradeItemList
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners