-------------------------------------------------------------------------------
--  Main spelling suggestion function
correct :: Words -> ByteString -> ByteString
correct ws w =  snd .
                Set.findMax .
                Set.map (flip (lookupWithDefault 1) ws  &&& id) .
                head .
                filter (not . Set.null) .
                map ($ w) $
                [ known ws . Set.singleton
                , known ws . edits1
                , knownEdits2 ws
                , Set.singleton
                ]
correct :: Words -> ByteString -> ByteString
correct ws w =  snd .
                Set.findMax .
                Set.map (flip (lookupWithDefault 1) ws  &&& id) .
                head .
                filter (not . Set.null) .
                map ($ w) $
                [ known ws . Set.singleton
                , known ws . edits1
                , knownEdits2 ws
                , Set.singleton
                ]
correct ws w =  snd .
                Set.findMax .
                Set.map (flip (lookupWithDefault 1) ws  &&& id) .
                head .
                filter (not . Set.null) .
                map ($ w) $
                [ known ws . Set.singleton
                , known ws . edits1
                , knownEdits2 ws
                , Set.singleton
                ]