Tagged Questions
0
votes
2answers
98 views
Haskell join getHomedirectory string
I have a file with strings which represent directories. Some of those strings have a tilde (~) in it.
I want to join the homedirectory (~) of a user to the rest of the string.
What I have so far:
...
0
votes
1answer
116 views
Increment the numeric part of a string identifier in Haskell
I have this code (I'm a Haskell newbie).
import Data.List.Split
padL :: Int -> String -> String
padL n s
| length s < n = replicate (n - length s) '0' ++ s
| otherwise = s
strInc ...
3
votes
2answers
125 views
Parsing an input file file in Haskell
Is there any fast way in Haskell to cast an input file like that into corresponding types? For example a function that takes a string and produces a list of Ints? Or do I need to parse it manually ...
1
vote
3answers
130 views
String concatenation with haskell state monad
I need to wrap my head around the state monad in haskell and I have some problems with that.
The task is to implement a function countConcat which concatenates string with the state monad and a ...
5
votes
1answer
167 views
How to write a pure String to String function in Haskell FFI to C++
there
I want to implement a function in C++ via Haskell FFI, which should have the (final) type of String -> String. Say, is it possible to re-implement the following function in C++ with the ...
3
votes
1answer
117 views
haskell read from file
i'm trying to read from file in haskell and process every line
what i have now
main = interact (unlines . (map calculate) . lines)
this let me get every line from input and send it to calculate
...
-1
votes
1answer
91 views
Matching letters in 2 strings with haskell [closed]
I just started with haskell and im wondering if there is a easy way to match the letters between 2 string and output them.
like:
iced and liked will return i,e,d
Thank you!
4
votes
2answers
207 views
Removing a string from a list of strings in Haskell
I have a question regarding Haskell that's been stumping my brain. I'm currently required to write a function that removes a string i.e. "word" from a list of strings ["hi", "today", "word", "Word", ...
4
votes
2answers
113 views
Replacing strings with strings from a list
I am trying to write a function that takes a list of searchwords, a list of replacementwords and a string on which those will be used.
listReplace :: [String] -> [String] -> String -> ...
2
votes
3answers
171 views
Haskell - filter string list based on some conditions
I am new in this comunity. I learn Haskell and have difficulties with Haskell-coding.
I hope you can help me.
I searched here and in Google, without any success.
My problem ist as fowllows:
I want ...
0
votes
2answers
162 views
How to replace more than one element at the same time in a String (Haskell)
i want to take 2 lists for example like this;
find=["Hou","House","Mouse"]
repl=["Mou","Bird","House"]
So when i give a text like that;
"The House with Mouse is big"
Output should be this;
"The ...
0
votes
3answers
99 views
List included in another list in haskell
I want to see if a list is included in another list and extract that list from a list of lists, for example i want to see if ["bc","abc"] is included in ...
0
votes
1answer
183 views
Break string into substring in haskell
I am having a problem with my function, I want to do a pattern matching on a string with my function but I have a problem with breaking the string into substrings. I want for a string like ...
1
vote
2answers
110 views
Haskell, returning String while using IO Integer to compute that string
Today I ran into the following problem:
I can read the current screen resolution in Haskell using Xlib-bindings using a function called getScreenWidth (--> I get an IO Integer). This is working so ...
0
votes
4answers
245 views
Concatenate String and IO Integer in Haskell
I wrote a function returning the current screen width as IO Integer (working so far).
getScreenWidth:: IO Integer
getScreenWidth = do
(sx, sy, w, h) <- getScreenDim 0
...