首页 \ 问答 \ 无法组成Cats Reader Monad(Not able to compose the Cats Reader Monad)

无法组成Cats Reader Monad(Not able to compose the Cats Reader Monad)

我写了以下代码

case class Foo(i: Int, j:Int)
def do1() : Reader[Foo, String] = Reader(f => s"doing ${f.i}")
def do2() : Reader[Foo, String] = Reader(f => s"doing ${f.j}")

现在,如果我尝试将这些组成另一个功能

def func() : Reader[Foo, List[String]] = Reader(f =>
  for {
    m1 <- do1()
    m2 <- do2()
  } yield List(m1, m2)
 }

我希望的是我会做func().run(Foo(10, 20))这会给我一个List列表(“做10”,“做20”)

但相反,我得到编译器错误

type mismatch;
 found   : cats.data.Kleisli[cats.Id,$sess.cmd1.Foo,List[String]]
 required: List[String]
m1 <- do1()
   ^
Compilation Failed

I have written the following code

case class Foo(i: Int, j:Int)
def do1() : Reader[Foo, String] = Reader(f => s"doing ${f.i}")
def do2() : Reader[Foo, String] = Reader(f => s"doing ${f.j}")

now if I try to compose these into another function

def func() : Reader[Foo, List[String]] = Reader(f =>
  for {
    m1 <- do1()
    m2 <- do2()
  } yield List(m1, m2)
 }

What I was hoping was that I will do func().run(Foo(10, 20)) and this will give me a list of List("doing 10", "doing 20")

but instead I get a compiler error

type mismatch;
 found   : cats.data.Kleisli[cats.Id,$sess.cmd1.Foo,List[String]]
 required: List[String]
m1 <- do1()
   ^
Compilation Failed

原文:https://stackoverflow.com/questions/43023377
更新时间:2023-04-19 10:04

最满意答案

这似乎是对你的情况的可能答案吗?

(来自http://www.uwplatt.edu/csse/tools/subversion/subversion-help.html )

“无法添加文件”(name here)':同名的对象已经存在。

要么

“无法打开文件”folder.svn \ tmp \ text-base \ file.svn-base':系统找不到指定的文件。

两者都意味着同一个文件夹中的两个文件具有与大小写相同的名称; 例如“Readme.txt”和“README.TXT”。 Unix和Subversion区分大小写,因此这些文件被认为是完全不相关的。 但是在Windows中不区分大小写,所以当它尝试在Readme.txt(比如说)上更新README.TXT时,它会中断。

解决问题的最重要的方法是登录到Unix系统(如io.uwplatt.edu),并使用unix notes来查看那里的存储库。 然后,您可以使用svn mv命令重命名其中一个文件。 如果您正在尝试将文件添加到存储库中,可以尝试使用TortoiseSVN-> Rename ...将现有文件重命名为完全不同的内容,然后进行更新。 请注意,您需要使用TortoiseSVN重命名命令; 仅在Windows资源管理器中重命名该文件将无法解决您的问题。

我有同样的错误,并且使用Tortoise SVN的repo浏览器能够确认存储库中有两个文件的名称只有大小写字母。 您还可以通过删除其中一个文件(通过repo浏览器首先做差异来确保您拥有所需的内容),通过repo浏览器来解决此问题。


Does this seem like a possible answer to your situation?

(from http://www.uwplatt.edu/csse/tools/subversion/subversion-help.html)

"Failed to add file '(name here)': object of the same name already exists.

or

"Can't open file 'folder.svn\tmp\text-base\file.svn-base': The system cannot find the file specified."

Both mean that two files in the same folder have the same name except for capitalization; for example "Readme.txt" and "README.TXT". Unix and Subversion are case-sensitive, so the files are considered to be completely unrelated. But in Windows is not case-sensitive, so when it tries to update README.TXT on top of Readme.txt (say), it breaks.

The surest way to fix the problem is to log in to a Unix system (such as io.uwplatt.edu) and use the unix notes to check out the repository there. You can then use the svn mv command to rename one of the files. If you are in the middle of trying to add a file to your repository, you might try using TortoiseSVN->Rename... to rename the existing file to something entirely different and then updating. Note that you need to use the TortoiseSVN rename commands; merely renaming the file in Windows Explorer won't fix your problems.

I had this same error, and using Tortoise SVN's repo browser was able to confirm that there were two files in the repository with the same name only varying by upper/lowercase letters. You can also fix this issue through the repo browser by deleting one of the files (you can do a diff first through repo browser to make sure you have what you need).

相关问答

更多
  • 您可以通过在svn命令的参数中指定完全限定路径来解决Windows上的此问题。 例如,而不是 c:\dev> svn co http://repoman.example/svn/myproj/trunk myproj 尝试这个 c:\dev> svn co http://repoman.example/svn/myproj/trunk c:\dev\myproj 由于某些原因, 路径长度限制仅适用于相对路径 。 Ok, so I have actually found the answer to my ...
  • 这似乎是对你的情况的可能答案吗? (来自http://www.uwplatt.edu/csse/tools/subversion/subversion-help.html ) “无法添加文件”(name here)':同名的对象已经存在。 要么 “无法打开文件”folder.svn \ tmp \ text-base \ file.svn-base':系统找不到指定的文件。 两者都意味着同一个文件夹中的两个文件具有与大小写相同的名称; 例如“Readme.txt”和“README.TXT”。 Unix和Su ...
  • 您似乎在系统上安装了一个版本的diff ,它太旧或与svn想要调用它的方式不兼容。 在我的系统中,-L选项因此被定义: -L label --label=label Use label instead of the file name in the context format and unified format headers. 因此,您应该使用diff命令删除该标志,然后再将其传递给系统的diff。 我做了类似的事情,在我的.subversion/configs文件中 ...
  • 尝试使用drwxrwxrwx然后如果它正在工作那么这是一个用户权限问题... 只需使用命令即可 chmod -R 777 svn_path_here 例如我有drwxrwx但我的svn文件夹的所有者是我的用户名..这不是根目录... 如果你想改变你的svn所有者..你可以这样做: chown -R myUsernameHere folderPathHere try having drwxrwxrwx and then if it is working then it's a user permissio ...
  • 修复它的最简单的方法(如果没有很多更改)将您的更改复制到另一个目录,删除项目签出的目录,并再次检出项目。 然后复制您的更改(不要复制任何.svn文件夹)并提交,并继续。 The easiest way to fix it (if you don't have many changes) is to copy your changes to another directory, delete the directory where your project is checked out, and checko ...
  • 为了搜索,我可以建议你看看ack吗? 这是一个源代码感知的find ,因此将自动忽略许多文件类型,包括源代码存储库信息,如上述。 For searching, can I suggest you look at ack ? It's a source-code aware find, and as such will automatically ignore many file types, including source code repository info such as the above.
  • Subversion的工作副本格式不是特别强大,并且它不时被破坏并不奇怪。 发生这种情况时,通常不值得修复它。 如果svn cleanup无法应付它,最好是: 检查出新的工作副本。 使用您喜欢的文件比较工具( Meld , WinMerge , KDiff3等)从损坏的工作副本中复制待处理的更改。 鉴于Subversion是一个集中式版本控制系统,您不应该丢失更改列表之外的重要信息,因为其他所有内容都存储在存储库中。 The Subversion working copy format is not par ...
  • 正如在您提到的主题中所接受的答案中,我建议使用TortoiseSVN的repo浏览器检查文件夹中的文件 - 您可能会发现两个具有相同名称但不同大小写的文件。 在repo浏览器中删除其中一个文件,然后再次尝试更新。 As in the accepted answer in the thread you referred to I would suggest inspecting the files in the folder using TortoiseSVN's repo browser - it appe ...
  • 使用不区分大小写的文件系统时,Subversion存在错误或限制: https://superuser.com/questions/303348/cant-checkout-in-subversion 检查包含两个文件的存储库时,通常会显示此错误,这两个文件的名称仅在大小写上有所不同。 当然,这些不能同时存在于不区分大小写的文件系统上的同一目录中。 SVN可以提供更有用的错误消息,但它无法真正解决问题。 您的问题有点不同,因为我假设您的文件系统中不再存在文件filetoupdate.h (旧案例)。 所以这 ...
  • 我通过以下方式解决了它: 制作了该文件的备份副本 恢复了svn中的本地文件 在备份文件上复制备份 现在一切都恢复正常了。 I solved it the following way: Made a backup copy of the file Reverted the local file in svn Copied the backup over the reverted file Now everything is back to normal.

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。