Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - import System.IO
 - import Graphics.UI.TinyFileDialogs
 - import Data.Text
 - openFilePath :: IO (Maybe String)
 - openFilePath = openFileDialog (pack "") (pack "") [] (pack "") False >>= \x -> extract x
 - where extract (Just [y]) = pure (Just (unpack y))
 - extract Nothing = pure Nothing
 - {-dialogedFileOpen :: Maybe (IO Handle)
 - dialogedFileOpen = openFilePath >>= \filePath ->
 - if filePath == "^ImprovErrorNotice" then Nothing else
 - Just (openFile filePath ReadMode)
 - where extractIO iostring = if iostring == "^ImprovErrorNotice" then
 - (Nothing) :: IO Maybe
 - -}
 - {-dialogedFileOpen :: IO (Maybe (IO Handle))
 - dialogedFileOpen = pure (openFileDialog >>= \check -> fmap (\filePath -> openFile filePath ReadMode) check)-}
 - {-dialogedFileOpen :: IO (Maybe (IO Handle))
 - dialogedFileOpen = openFilePath >>= (\x ->
 - case x of
 - Nothing -> Nothing
 - Just filePath ->
 - Just (openFile filePath ReadMode))-}
 - dialogedFileOpen :: IO (Maybe (IO Handle))
 - dialogedFileOpen = openFilePath >>= \x ->
 - case x of
 - Nothing -> pure Nothing
 - Just filePath ->
 - pure (Just (openFile filePath ReadMode))
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment