The previousLogItem
data type returned by esqueleto contains Data.Text.Internal.Lazy.Text
import Data.Text.Lazy (pack)
previousLogItem <- select $ from $ \l -> do
orderBy [desc (l ^. LogItemId)]
limit 1
return (l ^. LogItemTitle)
Later I tried to compare previousLogItem
with exampleCharList
by using:
[Value (pack currentWindowTitle)] == previousLogItem
But that does not work since the types still differ:
Couldn't match type ‘Data.Text.Internal.Lazy.Text’
with ‘Text’
NB: ‘Text’ is defined in ‘Data.Text.Internal’
‘Data.Text.Internal.Lazy.Text’
is defined in ‘Data.Text.Internal.Lazy’
arising from a functional dependency between:
constraint ‘Database.Esqueleto.Internal.Sql.SqlSelect
(SqlExpr (Value Text)) (Value Data.Text.Internal.Lazy.Text)’
arising from a use of ‘select’
instance ‘Database.Esqueleto.Internal.Sql.SqlSelect
(SqlExpr (Value a)) (Value a)’
Couldn't match type ‘Data.Text.Internal.Lazy.Text’
with ‘Text’
NB: ‘Text’ is defined in ‘Data.Text.Internal’
‘Data.Text.Internal.Lazy.Text’
You're using the wrong kind of Text
. Check your imports.
Edit: I misread the original question
Have you tried using fromString
from the IsString
class? Data.Text.Internal.Lazy.Text
should be an instance of IsString
Old (useless) answer:
Use the pack
function from Data.Text.Lazy
to convert the String
to Text
https://hackage.haskell.org/package/text-1.2.3.0/docs/Data-Text-Lazy.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.