Skip to content

Instantly share code, notes, and snippets.

@thomwiggers
Created October 14, 2012 14:21
Show Gist options
  • Save thomwiggers/3888740 to your computer and use it in GitHub Desktop.
Save thomwiggers/3888740 to your computer and use it in GitHub Desktop.
horz :: AlignV -> [Text] -> Text
horz av ts = Text LeftH av 0 0 (foldr addList [] (equalizeLists [] mahlines))
where
mahlines = [["foo","bar"],["foo","bar"]] --map (lines . show) ts
maxLenList = maxLength mahlines
equalizeLists list [] = list
equalizeLists list (l:ls)
| length l == maxLenList = equalizeLists (list++l) ls
| av == TopV
= equalizeLists list ((l++[replicate (length (head l)) ' ']):ls)
| av == CenterV && (length l + 2) <= maxLenList
= equalizeLists list (([replicate (length (head l)) ' '] ++ l
++[replicate (length (head l)) ' ']):ls)
| av == CenterV
= equalizeLists list ((l++[replicate (length (head l)) ' ']):ls)
| av == BottomV
= equalizeLists list (([replicate (length (head l)) ' ']++l):ls)
@thomwiggers
Copy link
Author

opdracht6.8.hs:97:39:
Couldn't match expected type Char' with actual type[a0]'
Expected type: [[a0]] -> String -> String
Actual type: [[a0]] -> [[a0]] -> [[a0]]
In the first argument of foldr', namelyaddList'
In the fifth argument of Text', namely (foldr addList [](equalizeLists [] mahlines))'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment