Search code examples
haskellyesod

How to assign to mvar with case syntax?


I'am asking if i can add same think like that :

if maVar == "false" then maVar = "" else maVar = maVar

in tmy code haskell (yesod)

let maVar= unpack $ case Map.lookup "maVarSession" sess of
        Just a -> a
        Nothing -> "Nothing"

Solution

  • No, maVar is imutable and it is String always.

    In Haskell there aren't any false. It has False.

    You could do next:

    let maVar = ...
    in
      let maVarNew = if maVar == "Nothing" then "" else maVar
      in