Right now, main has the following signature:

main :: Eff (dom :: DOM) (Maybe (Eff (dom :: DOM) (Maybe Element)))

I'd like to have the following:

main :: Eff (dom :: DOM) (Maybe Element)

findItem :: forall e. IsElement e => e -> Eff (dom :: DOM) (Maybe Element) findItem e = getElementsByClassName "thing" (toElement e) >>= (item 0) -- main :: Eff (dom :: DOM) (Maybe Element) main = (map findItem) <$> (window >>= document >>= body)

What is the best way to do this?

Of course, I could do the following:

findItem :: forall e. IsElement e => Maybe e -> Eff (dom :: DOM) (Maybe Element) findItem (Just e) = getElementsByClassName "findItemEdit" (toElement e) >>= (item 0) findItem Nothing = pure Nothing main :: Eff (dom :: DOM) (Maybe Element) main = findItem =<< body =<< document =<< window