Do while loop in Haskell

haskell, recursion

Solution

In most cases, especially when your problem is a particular case of solved one, explicit resursion is bad. One of possible solutions of your problem without using explicit recursion is:

import Data.List (find)
import Data.Maybe (fromJust)

findIt :: Int -> Int
findIt n = fromJust $ find isItSimple [n..]

Problem

I have a function: ``` isItSimple :: Int -> Bool ``` it gets Int and return Bool. I need to find first number in [x | x <- [n..], isItSimple x]. Here is my solution: ``` findIt :: Int -> Int findIt num | isItSimple num = num | otherwise = findIt (num + 1) ``` Is there any better solution in Haskell?

Original source