关于归纳数据类型和模式匹配的 Agda手册:
为确保正常化,归纳事件必须出现在严格的正位置.例如,不允许以下数据类型:
Run Code Online (Sandbox Code Playgroud)data Bad : Set where bad : (Bad ? Bad) ? Bad因为构造函数的参数中存在负面的Bad.
为什么归纳数据类型需要此要求?
haskell y-combinator recursive-datastructures algebraic-data-types agda
我目前正在处理一个三级流程,我需要一些信息才能访问和更新.信息也是三级的,这样一个级别的过程可能需要在其级别和更高级别访问/更新信息.
type info_0 = { ... fields ... }
type info_1 = { ... fields ... }
type info_2 = { ... fields ... }
Run Code Online (Sandbox Code Playgroud)
fun0会用a做一些东西info_0,然后将它传递给fun1a info_1,然后返回结果info_0并继续,fun1用另一个调用另一个info_1.同样的情况发生在较低级别.
我目前的代表有
type info_0 = { ... fields ... }
type info_1 = { i0: info_0; ... fields ... }
type info_2 = { i1: info_1; ... fields ... }
Run Code Online (Sandbox Code Playgroud)
在fun2,更新info_0变得非常混乱:
let fun2 (i2: info_2): info_2 =
{ …Run Code Online (Sandbox Code Playgroud) 所以,这是一个个人问题,但也许人们会有很好的建议或解决方法.
问题是在Debian下安装cabal-install和haskell-platform.
当你apt-get install haskell-platform,它随附cabal-install,它的命令cabal可用.
现在这cabal-install不是最新的:
> which cabal
/usr/bin/cabal
> /usr/bin/cabal --version
cabal-install version 0.8.0
using version 1.8.0.2 of the Cabal library
Run Code Online (Sandbox Code Playgroud)
但是,我对跑步的理解cabal update是它更新了cabal,但由于它不是"Debian thingy",它将它放入~/.cabal/bin/.
> ~/.cabal/bin/cabal --version
cabal-install version 0.8.2
using version 1.8.0.2 of the Cabal library
Run Code Online (Sandbox Code Playgroud)
现在我的系统有2个cabals,而我输入cabal的那个不是我想要使用的那个...因为它会不断更新另一个而不是自己,因此无效.
所以我做的是我把它别名~/.bashrc:
alias cabal='~/.cabal/bin/cabal'
Run Code Online (Sandbox Code Playgroud)
现在:
> cabal --version
cabal-install version 0.8.2
using version 1.8.0.2 of the Cabal library
Run Code Online (Sandbox Code Playgroud)
所以,我最后的问题:
which cabal仍指向我的无用 …是否有haskell库函数来监视文件而不进行轮询?
通过民意调查我会做这样的事情:
monitor file mtime handler = do
threadDelay n -- sleep `n` ns
t <- getModificationTime file
if t > mtime
then handler >> monitor file t handler
else monitor file mtime handler
Run Code Online (Sandbox Code Playgroud)
我想要的是一个阻塞的getModificationTime,它将被系统唤醒.有什么东西可用吗?
如果只有posix系统可用,我会非常高兴,但越便携越好:-)
编辑:我知道 hinotify,但我在Mac上(这就是为什么我提到POSIX).
我无法通过帮助类型检查器来理解以下是否可行,或者完全不可能.设置略微任意的,我只是需要与镜头,这里所说的一些嵌套的数据类型A,B,C.
我的问题是我可以使用复合镜头,(bLens . a)如果我立即调用类似的东西view,但如果我尝试让它绑定并给它一个名字,我会得到错误信息.
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MonoLocalBinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
module Debug where
import Control.Eff
import Control.Eff.Reader.Strict
import Control.Lens
data A = A
data B = B
{ _a :: A
}
makeLenses ''B
data C = C
{ _b :: B
}
makeLenses ''C
askLensed :: ( Member (Reader r) e ) => Lens' r …Run Code Online (Sandbox Code Playgroud) 我无法以正确的顺序显示列表主题的值.以下是列表中的字段(带有实际的系统名称):
-Title -Category -NominatedWon -Logo
"标题"字段包含年份值,例如"2011","2010"等.
//getting the awards list and extracting correct values from the necesary fields
//asp running with elevated privilegs
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(webUrl))
{
using (SPWeb web = site.OpenWeb())
{
try
{
SPList awardsList = web.Lists["Awards"];
SPListItemCollection listItemCollection = awardsList.Items;
//Creating the table
Table tbl = new Table();
//foreach (SPListItem oListItem in listItemCollection)
int x = listItemCollectionI.Count;
for(int i = 0; (i * 2) < x; i++) // divide total item collection …Run Code Online (Sandbox Code Playgroud) 我整个下午都在尝试实现一个相当简单的设计,首先使用 Flex,然后只使用旧的 div,但仍然卡住了。
HTML 布局相当简单。
<div id="interface">
<div id="toolbar">
Toolbar<br/>Toolbar
</div>
<div id="main">
<div id="main-left">
This should take the full vertical space remaining after the toolbar,
and half the horizontal space.
</div>
<div id="main-right">
<div id="context">
This should take half and half the remaining space after the toolbar.
</div>
<div id="messages">
This should take half and half the remaining space after the toolbar.
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
问题是,我希望我的布局具有:
#toolbar高度不固定的顶部
屏幕的其余部分#main应垂直分割 50%
在左边,整个高度应该被#main-left
右侧部分#main-right应水平分割,两个部分 ( …
haskell ×4
agda ×1
busy-waiting ×1
c# ×1
cabal ×1
caml ×1
css ×1
debian ×1
foreach ×1
functor ×1
haskell-lens ×1
inotify ×1
listitem ×1
nested ×1
ocaml ×1
polling ×1
records ×1
sml ×1
unification ×1
y-combinator ×1