Hello.
I'm new to Haskell and this is the first time I use Data.Text module.
And using stack on OSX 10.12.3
I'm try several times, but fail. and I don't understand what error message says.
How can I fix this?
Thank you a lot.
Code is
Main.hs :
module Main where
import Lib
main :: IO ()
main = do
sam <- readSam
rxDxData <- readCSV
print $ makeRxDxList rxDxData
Lib.hs :
module Lib
-- ( someFunc
-- ) where
where
import Data.Text as T
import Text.Regex.TDFA
import Prelude hiding (take, drop, map, lines)
type RowSAM = Text
type RowRxDx = Text
--makeRxDxList :: Functor f => f Text -> f [Text]
--makeRxDxList rowRxDx = fmap (\x -> splitOn (pack ",") x) rowRxDx -- This code pass a compile.
makeRxDxList rowRxDx = map (\x -> splitOn (pack ",") pack x) $ lines rowRxDx
(whole code is below...)
Error Message is
/Users/shaegis/Documents/Haskell/samChecker3/src/Lib.hs:25:35: error:
• Couldn't match expected type ‘Char -> Char’
with actual type ‘[Text]’
• The function ‘splitOn’ is applied to three arguments,
but its type ‘Text -> Text -> [Text]’ has only two
In the expression: splitOn (pack ",") pack x
In the first argument of ‘map’, namely
‘(\ x -> splitOn (pack ",") pack x)’
/Users/shaegis/Documents/Haskell/samChecker3/src/Lib.hs:25:54: error:
• Couldn't match expected type ‘Text’
with actual type ‘String -> Text’
• Probable cause: ‘pack’ is applied to too few arguments
In the second argument of ‘splitOn’, namely ‘pack’
In the expression: splitOn (pack ",") pack x
In the first argument of ‘map’, namely
‘(\ x -> splitOn (pack ",") pack x)’
/Users/shaegis/Documents/Haskell/samChecker3/src/Lib.hs:25:64: error:
• Couldn't match expected type ‘Text’ with actual type ‘[Text]’
• In the second argument of ‘($)’, namely ‘lines rowRxDx’
In the expression:
map (\ x -> splitOn (pack ",") pack x) $ lines rowRxDx
In an equation for ‘makeRxDxList’:
makeRxDxList rowRxDx
= map (\ x -> splitOn (pack ",") pack x) $ lines rowRxDx
------------------------------------------------------------------------------------------------------
Lib.hs