Skip to content

Instantly share code, notes, and snippets.

@richyk1
Created February 27, 2020 14:56
Show Gist options
  • Select an option

  • Save richyk1/490e05dabb325fb8f60a82bef842901c to your computer and use it in GitHub Desktop.

Select an option

Save richyk1/490e05dabb325fb8f60a82bef842901c to your computer and use it in GitHub Desktop.

Revisions

  1. richyk1 created this gist Feb 27, 2020.
    18 changes: 18 additions & 0 deletions haskell being a bitch.hs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    personExists :: Person -> Bool
    personExists (Person id name lastname password) = do
    let
    database = "database.txt"

    contents <- readFile database
    if (contents > 0) then do
    let
    (x:xs) = splitOn "\n" contents
    person = id ++ ";" ++ name ++ ";" ++ lastname ++ ";" ++ password

    existsInList person [] = False
    existsInList person (x:xs) | person == x = True
    | otherwise = existsInList person xs
    -- issue is on this "in" ; Storage.hs:36:9: error: parse error on input `in'
    in existsInList person (x:xs)

    else False