我第一次使用Edward Kmett的镜头库,发现它相当不错,但我遇到了麻烦...
[1]中的问题解释了存在量词会破坏makeLenses.我真的很想以某种方式使用带镜片的存在主义.
作为背景,我有课:
class (TextShow file, Eq file, Ord file, Typeable file) => File file where
fromAnyFile :: AnyFile -> Maybe file
fileType :: Simple Lens file FileType
path :: Simple Lens file Text.Text
provenance :: Simple Lens file Provenance
Run Code Online (Sandbox Code Playgroud)
对于实际问题,我想要的类型:
data AnyFile = forall file . File file => AnyFile { _anyFileAnyFile :: File }
Run Code Online (Sandbox Code Playgroud)
我希望能够写下以下内容:
instance File AnyFile where
fromAnyFile (AnyFile file) = cast file
fileType (AnyFile file) = fileType . anyFile
path (AnyFile file) …Run Code Online (Sandbox Code Playgroud) 在jquery-mobile中开发webapp时,我遇到了一些奇怪的错误.当我提示警报时,如果我触摸该页面的某些输入,iOS Safari和Chrome将完全冻结,我只能通过任务管理器关闭它们.
如果它是苹果故障或者它是我的,我很困惑.
一些代码:
$('.checkout-comprar-button').click(function(){
alert("hola!!!");
});
Run Code Online (Sandbox Code Playgroud)
这是事件的div:
<div class="grp-bottombar-button checkout-comprar-button" style="width: 50% !important; float: right !important; display: block !important; padding-top: 12px;">
<span class="green-desplegable grp-bottombar-button-text">
<? echo _("checkoutcreditcard.seguircompra"); ?>
</span>
</div>
Run Code Online (Sandbox Code Playgroud)
这是输入之一:
<div class="checkout-datos-numero checkout-first-form checkout-form-field-container">
<div class="checkout-field">
<input type="tel" placeholder="<? echo _('creditcard.numero'); ?>" name="" id="checkout-num-tarjeta" maxlength="30" />
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
显示警报后,如果我想要关注一些输入,浏览器会冻结.当我强制关闭Safari时,这是控制台给我的消息:
<Warning>: MobileSafari[2985] has active assertions beyond permitted time:
{(
<BKProcessAssertion: 0x1e857480> identifier: Suspending process: MobileSafari[2985] permittedBackgroundDuration: 10.000000 reason: suspend owner pid:26 preventSuspend preventThrottleDownCPU preventThrottleDownUI
)}
<Warning>: Forcing crash report …Run Code Online (Sandbox Code Playgroud)