Guest User

Untitled

a guest
Jan 4th, 2022
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import System.IO
  2. import Graphics.UI.TinyFileDialogs
  3. import Data.Text
  4.  
  5. openFilePath :: IO (Maybe String)
  6. openFilePath = openFileDialog (pack "") (pack "") [] (pack "") False >>= \x -> extract x
  7.        where extract (Just [y]) = pure (Just (unpack y))
  8.              extract Nothing = pure Nothing
  9.  
  10. {-dialogedFileOpen :: Maybe (IO Handle)
  11. dialogedFileOpen =  openFilePath >>= \filePath ->
  12.     if filePath == "^ImprovErrorNotice" then Nothing else
  13.         Just (openFile filePath ReadMode)
  14.  
  15.         where extractIO iostring = if iostring == "^ImprovErrorNotice" then
  16.             (Nothing) :: IO Maybe
  17. -}
  18.  
  19. {-dialogedFileOpen :: IO (Maybe (IO Handle))
  20. dialogedFileOpen = pure (openFileDialog >>= \check -> fmap (\filePath -> openFile filePath ReadMode) check)-}
  21.  
  22. {-dialogedFileOpen :: IO (Maybe (IO Handle))
  23. dialogedFileOpen = openFilePath >>= (\x ->
  24.     case x of
  25.         Nothing -> Nothing
  26.         Just filePath ->
  27.             Just (openFile filePath ReadMode))-}
  28.  
  29.  
  30. dialogedFileOpen :: IO (Maybe (IO Handle))
  31. dialogedFileOpen = openFilePath >>= \x ->
  32.     case x of
  33.         Nothing -> pure Nothing
  34.         Just filePath ->
  35.             pure (Just (openFile filePath ReadMode))
Advertisement
Add Comment
Please, Sign In to add comment