小编s9g*_*ult的帖子

Yesod(hamlet)模板中的注释语法是什么?

我只是找不到如何在hamlet模板中注释行.是否有一些注释语法?喜欢

-- <p>Some code should be ignored by template
Run Code Online (Sandbox Code Playgroud)

或者其他的东西?

templates haskell yesod hamlet shakespeare-text

12
推荐指数
1
解决办法
594
查看次数

Ruby on Rails:如何检查多元化和单一形式的名称

我用命令创建了一个模型Anonymous

rails g model Anonymous section_id:integer aid:string fake:bool active:bool
Run Code Online (Sandbox Code Playgroud)

但迁移中的表名称称为匿名

class CreateAnonymous < ActiveRecord::Migration
  def change
    create_table :anonymous do |t|
      t.integer :section_id
      t.string :aid
      t.bool :fake
      t.bool :active

      t.timestamps
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

我是对的,Anonymous的复数形式也是Anomymous吗?(英语不是我的母语).我如何才能看到Rails为我的模型提供的复数名称?有点像rake routes

ruby-on-rails introspection pluralize ruby-on-rails-3

7
推荐指数
1
解决办法
3772
查看次数

根据windows下的iconv构建Haskell程序

我有一个项目取决于iconv,因为我需要使用cp1251代码页.这是问题项目的最小实现.我从这里安装了iconv 并成功安装了像这样的haskell软件包"iconv"

cabal install iconv --extra-include-dirs="C:\GnuWin32\include" --extra-lib-dirs="C:\GnuWin32\lib"
Run Code Online (Sandbox Code Playgroud)

软件包iconv已正确安装,但依赖于它的项目在链接时失败,以下是正在进行的操作.

c:\iconvsmpl>cabal configure --extra-include-dirs="C:\GnuWin32\include" --extra-
lib-dirs="C:\GnuWin32\lib"
Warning: The package list for 'hackage.haskell.org' is 16 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
Configuring iconvsmpl-0.1.0.0...
Warning: The 'license-file' field refers to the file 'LICENSE' which does not
exist.

c:\iconvsmpl>cabal build
Building iconvsmpl-0.1.0.0...
Preprocessing executable 'iconvsmpl' for iconvsmpl-0.1.0.0...
[1 of 1] Compiling Main             ( iconvsmpl.hs, dist\build\iconvsmpl\iconvsm
pl-tmp\Main.o )
Linking dist\build\iconvsmpl\iconvsmpl.exe ...
C:\Users\admin\AppData\Roaming\cabal\iconv-0.4.1.1\ghc-7.6.3/libHSiconv-0.4.1.1.
a(hsiconv.o):hsiconv.c:(.text+0x7): undefined …
Run Code Online (Sandbox Code Playgroud)

windows linker haskell building libraries

6
推荐指数
1
解决办法
537
查看次数

如何在Yesod应用程序中的GHCi中执行数据库查询

例如,如何使用Yesod应用程序的模型将新用户插入数据库?或者,还有更好的方法?

我正在处理脚手架应用程序.现在我创建了App实例,并且不知道如何使用它来执行请求.

:i Extra
data Extra
  = Extra {extraCopyright :: Data.Text.Internal.Text,
           extraAnalytics :: Maybe Data.Text.Internal.Text}
        -- Defined in `Settings

let e = Extra "asdf" Nothing
let c = AppConfig {appEnv = Development, appPort = 3000, appRoot = "/", appHost = "localhost", appExtra = e}
f <- makeFoundation c
:t f
f :: App

:i App
data App
  = App {settings :: AppConfig DefaultEnv Extra,
         getStatic :: Yesod.Static.Static,
         connPool :: persistent-1.2.3.0:Database.Persist.Class.PersistConfig.PersistConfigPool
                       PersistConf,
         httpManager :: http-client-0.2.0.1:Network.HTTP.Client.Types.Manager,
         persistConfig :: PersistConf,
         appLogger …
Run Code Online (Sandbox Code Playgroud)

haskell persistent ghci yesod

6
推荐指数
1
解决办法
598
查看次数

Haskell库中某处的整数设施功能?

我发现一些库实现了整数分解功能.最好在一些流行的库中快速实现,以免重新发明轮子.

有一些吗?

math haskell integer function

5
推荐指数
1
解决办法
153
查看次数

如何按内容确定文件MIME类型?

有没有办法通过它的内容来确定文件的MIME类型?也许有一些Haskell库?

mime haskell

5
推荐指数
1
解决办法
477
查看次数