I have just started finding my way through Haskell text manipulation with overloaded strings and I was about to love it when this happened

https://wiki.haskell.org/Tutorials/Programming_Haskell/Argument_handling
tfw map putStrLn args didn't work because monads so I have to use mapM_ putStrLn args instead :blobcatderpy:
OK so now it also happens that Prelude.putStrLn isn't compatible with Text despite string overloading so I have to use Data.Text.IO, I'm also really am being insisted on more Prelude namespace conflicts so I have to do import qualified Data.Text as T as well as import qualified Data.Text.IO as TIO and my code isn't as beautiful anymore, and SOMEHOW I'm still getting a type mismatch?????
This doesn't feel like inherent issues with static typing, this feels like proper string manipulation with overloaded types and Unicode support was an afterthought
Terminal
Terminal Terminal Terminal Terminal
OK, so I thought about doing the import Prelude hiding thing, this looks much better now
So far, the weirdest part about learning Haskell? I've barely even touched the books! When you understand the theoretical basics intuitively (which you will if you're doing an uni grade while keeping up) and you know how to use the docs (which you will as soon as you understand typing), you can guide yourself through it! That being said, I'm weak at anonymous functions, list comprehensions, patterns, functors/monads and arrows, mostly because I hadn't had to use them much. And yeah, I wish the Prelude was made for Data.Text and that [Char] instanced IsString by default. And I can't wait for complex data structures with zippers :blobcatderpy:
Also, what I said yesterday about OverloadedStrings not including [Char] makes no sense
tech tip: try to use only one text datatype, unwrap IO monads with >>= and wrap with return, and take advantage of interact
I made A LOT of versions of this program (at least 6 that worked!), but here's the final product! I think it looks pretty cute :blobcat: (P.S.: remember composition goes from right to left, as in g . f = g(f(x)) = "g on f of x")
Made a finaler version of the program, now it allows choosing a chunking length! :blobcatsip: Wow, argument handling takes a BIG toll Also weird to see Data.Text.Lazy.chunksOf uses Int64 instead of Int, huh? Also I wish there was proper optional arguments, might rewrite this using record syntax
Sign in to participate in the conversation
Game Liberty Mastodon

Mainly gaming/nerd instance for people who value free speech. Everyone is welcome.