Questions tagged [lifting]

a transformation of a function into a corresponding function in a more general context.

84 questions
0
votes
1 answer

Is there any way to "lift" a constructor?

Assume I have a function (plusOne in the example below) that only accepts and returns an Int. But I don't have an Int; instead, I have a Maybe Int; and if this Maybe Int contains a value then I want to pass it to plusOne and get a Just of whatever…
user4385532
0
votes
1 answer

Changing the displayed value of react-select by clicking on an external component in React

From one array, I have it displayed as a list on one component(Box.js) and stored in a react-select in another component(Search.js). Both of them are a same level children belonging to a parent component(trial.js). Ultimately, I want to display the…
episodewon
  • 29
  • 2
  • 7
0
votes
1 answer

scala quasiquotes string variable lifting in multiple steps

this is what i want: scala> var x:Int = 10 x: Int = 10 scala> var y:Int = 20 y: Int = 20 scala> val ret = q"return $x>$y" ret: universe.Return = return 10.$greater(20) scala> val result1 = toolbox.compile(ret)() result1: Any = false But the…
Pankaj
  • 346
  • 1
  • 3
  • 14
0
votes
1 answer

Scala: what does _ represent in this case

I'm reading a tutorial for demonstration about lifting method in Scala. Here is the code for basic class: case object None extends Optional[Nothing] case class Presenter[+A](get: A) extends Optional[A] trait Optional[+A] { def map[B](f: A => B):…
Trần Kim Dự
  • 5,872
  • 12
  • 55
  • 107
0
votes
2 answers

Scala lift from List[A] to List[Option[A]]

In scala, how can i create a general purpose function to perform the following operation: f: List[A] ==> List[Option[A]]
raul ferreira
  • 886
  • 7
  • 21
0
votes
0 answers

Haskell : "lifting" a data type to a function

Somehow, I'm still trying to build an intuition on what can I express in Haskell and what not. I have my own (simple) matrix type and I'm wondering if it would be possible to somehow "lift" it to a function so as to make sense of the usual math…
MASL
  • 929
  • 1
  • 11
  • 25
0
votes
1 answer

Haskell: writing a function such that it can be lifted to work on lists

I have the following 2 functions: import qualified Data.Text as T noneOnEmptyA :: T.Text -> T.Text noneOnEmptyA txt | T.null txt = "None." | otherwise = txt noneOnEmptyB :: [T.Text] -> [T.Text] noneOnEmptyB txts | null txts =…
the-konapie
  • 601
  • 3
  • 10
0
votes
1 answer

Type constraints for polymorphic functions like lift

So I have this code {-# LANGUAGE GeneralizedNewtypeDeriving #-} import MonadA data A = A newtype MonadA a => MyStateT a b { runMyStateT :: StateT A a b } deriving (Functor, Applicative, Monad, MonadIO, MonadState A) instance MonadTrans…
jakubdaniel
  • 2,233
  • 1
  • 13
  • 20
0
votes
1 answer

Pipes.Safe - how to use mapM

I have the following code with a pipe which is ok without the second pipe (>-> P.mapM ( fillMD5)). fillMD5 is an operation a -> IO a. runSafeT $ runEffect $ every (senseRecursive5 startfpo) >-> P.mapM ( fillMD5) >-> P.map…
user855443
  • 2,596
  • 3
  • 25
  • 37
1 2 3 4 5
6