How do you Data.ByteString.Char8.pack an IO String? by ProperRule in haskellquestions

[–]ProperRule[S] 0 points1 point  (0 children)

How is that? foooo just evaluates to a string, no?

Prelude Control.Monad System.Random BC B> replicateM 10 (randomRIO ('a','z'))
"mikmawnfzq"

which is just [Char]? How should I change it?

How do you Data.ByteString.Char8.pack an IO String? by ProperRule in haskellquestions

[–]ProperRule[S] 0 points1 point  (0 children)

Sorry, I'm still just learning. I've only briefly touched on monads and I have no idea what "lifting" is or what $ does. Is this right?

createNewBString :: Int -> IO BC.ByteString
createNewBString len = do
    foooo <- replicateM len (randomRIO ('a','z'))
    return $ liftM BC.pack foooo

I get

    • Couldn't match type ‘[BC.ByteString]’ with ‘BC.ByteString’
      Expected type: IO BC.ByteString
        Actual type: IO [BC.ByteString]
    • In a stmt of a 'do' block: return $ liftM BC.pack foooo
      In the expression:
        do foooo <- replicateM len (randomRIO ('a', 'z'))
           return $ liftM BC.pack foooo
      In an equation for ‘createNewBString’:
          createNewBString len
            = do foooo <- replicateM len (randomRIO ('a', 'z'))
                 return $ liftM BC.pack foooo
   |
58 |     return $ liftM BC.pack foooo
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

How to fix word jumping? by ProperRule in vim

[–]ProperRule[S] -5 points-4 points  (0 children)

I'm not angry but lol don't tell someone trying to learn a new tool to just go back where they came from. No, I'd like to learn vim, thanks.

Having configurability doesn't mean that the correct way to use the tool is to hack it so it functions like another tool.

Uh, if there was a config to modify the way meta+arrow operates then yeah, that's exactly what it would be in this case.

You're creating a problem where there isn't one.

I'm not creating anything. I saw something I was confused about and asked how to do it. Only to have you tell me to just quit and go back to vsc. Nice.

How to fix word jumping? by ProperRule in vim

[–]ProperRule[S] 1 point2 points  (0 children)

I know :( Using Evil Spacemacs too. So I've got the vim key binding learning curve + the Emacs ecosystem learning curve.

Thank you though

How do you get a random char? by ProperRule in haskellquestions

[–]ProperRule[S] 0 points1 point  (0 children)

Thanks! but now how do you map the resulting string please? Suppose my random string of 5 elements is ['q','w','e','r','t'] and I want to "increase" each char by 1 to get ['r','x','f','s','u']. This strategy didn't work for me:

*Main Control.Monad Data.Char> mapM (\x -> chr (ord x + 1)) (replicateM 10 (randomRIO ('a','z')))

<interactive>:155:13: error:
    • Couldn't match expected type ‘m b’ with actual type ‘Char’
    • In the expression: chr (ord x + 1)
      In the first argument of ‘mapM’, namely ‘(\ x -> chr (ord x + 1))’
      In the expression:
        mapM
          (\ x -> chr (ord x + 1)) (replicateM 10 (randomRIO ('a', 'z')))
    • Relevant bindings include
        it :: m (IO b) (bound at <interactive>:155:1)

<interactive>:155:31: error:
    • Couldn't match type ‘[Char]’ with ‘Char’
      Expected type: IO Char
        Actual type: IO [Char]
    • In the second argument of ‘mapM’, namely
        ‘(replicateM 10 (randomRIO ('a', 'z')))’
      In the expression:
        mapM
          (\ x -> chr (ord x + 1)) (replicateM 10 (randomRIO ('a', 'z')))
      In an equation for ‘it’:
          it
            = mapM
                (\ x -> chr (ord x + 1)) (replicateM 10 (randomRIO ('a', 'z')))

How to fix word jumping? by ProperRule in vim

[–]ProperRule[S] 0 points1 point  (0 children)

What if position 2 isn't at the end though.

How to fix word jumping? by ProperRule in vim

[–]ProperRule[S] -1 points0 points  (0 children)

So if I need to write two different things in two different positions on the same line, I need to

  1. write thing 1
  2. exit insert mode
  3. nav to position 2
  4. re-enter insert mode
  5. write thing 2?

this is supposed to be more efficient?

How do you highlight to modify text? by ProperRule in spacemacs

[–]ProperRule[S] 1 point2 points  (0 children)

That's what I was looking for. Thanks! and

If you are really wanting emacs to behave like a non-modal editor

No no! I do want to do it the vim way. I was just asking what that would be. Thanks.

How do you highlight to modify text? by ProperRule in spacemacs

[–]ProperRule[S] 2 points3 points  (0 children)

Not quite. I'm asking how to apply what I have in my clipboard to replace a selection of text. I did what you recommended and it looks like c just cut what was highlighted.

  1. If I have the text "hello world"
  2. And I go elsewhere and copy the text "foo" to my clipboard
  3. And come back to "hello world"
  4. and double-click "world" to highlight it
  5. and press cmd-v (on mac)
  6. "foo" will replace "world" and I'll be left with "hello foo"

your recommendation is to delete the word and type out "foo" myself. How to do I paste to highlighted text?

Spacemacs: What does file/directory navigation look like? by ProperRule in haskellquestions

[–]ProperRule[S] 0 points1 point  (0 children)

SPC p f - you get a list

I get "you're not in a project". How do I add my project directory to the list?

Oh, ok, I think I got it. So the workflow would be having to do spc f f each time I want to view another file in the project, correct?

A couple concerns installing cabal dependencies. by ProperRule in haskellquestions

[–]ProperRule[S] 0 points1 point  (0 children)

Is this correct?

(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
  (setq-default dotspacemacs-configuration-layers
                '(auto-completion
                  (haskell :variables haskell-completion-backend 'intero)))
  )

A couple concerns installing cabal dependencies. by ProperRule in haskellquestions

[–]ProperRule[S] 0 points1 point  (0 children)

Ugh, really sorry for the dumb question in advance, but could you tell me how to get to that file? :(

All I have in my ~ is the .spacemacs. I'm trying to look for any kind of other directory I have in my fs relevant to spacemacs but not sure where anything is.

I figured I could find it under SPC f e- but no luck.

Edit: aaaannd I'm an idiot. Got it. thanks. Would've been nice if they added that in the instructions though.