0

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)’
Răzvan Flavius Panda
  • 21,730
  • 17
  • 111
  • 169

2 Answers2

2
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.

0

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

Probie
  • 1,371
  • 7
  • 15